Senthilkanth,MCA..
The following ppt's full topic covers Operating System for BSc CS, BCA, MSc CS, MCA students..
1.Introduction
2.OS Structures
3.Process
4.Threads
5.CPU Scheduling
6.Process Synchronization
7.Dead Locks
8.Memory Management
9.Virtual Memory
10.File system Interface
11.File system implementation
12.Mass Storage System
13.IO Systems
14.Protection
15.Security
16.Distributed System Structure
17.Distributed File System
18.Distributed Co Ordination
19.Real Time System
20.Multimedia Systems
21.Linux
22.Windows
Waiting for the Linux-version: Checking the Code of Inkscape Graphics EditorPVS-Studio
In this article, I talk about the analysis results for another popular open-source project, vector graphics editor Inkscape 0.92. The project has been developing for over 12 years now and provides a large number of features to work with various vector-image formats. Over this time, its code base has grown up to 600 thousand lines of code, and now is the right time to check it with PVS-Studio static analyzer.
This is the correct article about the results of checking the Geant4 project, which I have written after the previous incorrect one. Let me remind you the whole story. I have recently checked an old version of the Geant4 library and reported the results in the article "Copy-Paste and Muons". Why old version? Nobody is perfect, and we finally made a mistake ourselves. To find out which exactly, see the previous article. This time I offer you a brief report about checking Geant4 of the version 10.0-beta.
In this article I'm going to show you some examples explaining why physicists developing software products to be used in their field should also use static code analysis tools. I would be glad to see PVS-Studio in this role, but any other analyzer would do as well, of course. A code analyzer can significantly reduce the debugging time and headache from silly mistakes. Isn't it better when you can focus on physics rather than waste time seeking and fixing bugs in C++ applications?
ReactOS is intensively developing, and its codebase is steadily growing in size. On February 16, 2016, a new version of the operating system was released, and we thought it was a good occasion to run it through our static analyzer one more time. The new scan was done with PVS-Studio, version 6.02.
Sergiy Grytsenko, Senior Software Engineer
“Reactive Extensions: classic Observer in .NET”
• Why should we use Rx when we have events?
• Key types & methods
• Lifetime management, flow control
• Combining several streams
• Tests, I need unit tests!
In most of our articles about project checks, we mention that bugs are found by the PVS-Studio static code analyzer. In certain cases – when dealing with projects of a complex structure – it is this particular analyzer that is needed. However, many developers will also appreciate its lightweight version, the CppCat analyzer. In this connection, we decided to use CppCat this time, when checking the TortoiseGit project.
Static analysis should be used regularlyPVS-Studio
We have a practice of occasionally re-analyzing projects we have already checked with PVS-Studio. There are several reasons why we do so. For example, we want to know if we have managed to eliminate false positives for certain diagnostics. But the most interesting thing is to see how new diagnostic rules work and what errors they can find. It is very interesting to watch the tool catch more and more new defects in a project that seems to be cleaned out already. The next project we have re-checked is Clang.
Waiting for the Linux-version: Checking the Code of Inkscape Graphics EditorPVS-Studio
In this article, I talk about the analysis results for another popular open-source project, vector graphics editor Inkscape 0.92. The project has been developing for over 12 years now and provides a large number of features to work with various vector-image formats. Over this time, its code base has grown up to 600 thousand lines of code, and now is the right time to check it with PVS-Studio static analyzer.
This is the correct article about the results of checking the Geant4 project, which I have written after the previous incorrect one. Let me remind you the whole story. I have recently checked an old version of the Geant4 library and reported the results in the article "Copy-Paste and Muons". Why old version? Nobody is perfect, and we finally made a mistake ourselves. To find out which exactly, see the previous article. This time I offer you a brief report about checking Geant4 of the version 10.0-beta.
In this article I'm going to show you some examples explaining why physicists developing software products to be used in their field should also use static code analysis tools. I would be glad to see PVS-Studio in this role, but any other analyzer would do as well, of course. A code analyzer can significantly reduce the debugging time and headache from silly mistakes. Isn't it better when you can focus on physics rather than waste time seeking and fixing bugs in C++ applications?
ReactOS is intensively developing, and its codebase is steadily growing in size. On February 16, 2016, a new version of the operating system was released, and we thought it was a good occasion to run it through our static analyzer one more time. The new scan was done with PVS-Studio, version 6.02.
Sergiy Grytsenko, Senior Software Engineer
“Reactive Extensions: classic Observer in .NET”
• Why should we use Rx when we have events?
• Key types & methods
• Lifetime management, flow control
• Combining several streams
• Tests, I need unit tests!
In most of our articles about project checks, we mention that bugs are found by the PVS-Studio static code analyzer. In certain cases – when dealing with projects of a complex structure – it is this particular analyzer that is needed. However, many developers will also appreciate its lightweight version, the CppCat analyzer. In this connection, we decided to use CppCat this time, when checking the TortoiseGit project.
Static analysis should be used regularlyPVS-Studio
We have a practice of occasionally re-analyzing projects we have already checked with PVS-Studio. There are several reasons why we do so. For example, we want to know if we have managed to eliminate false positives for certain diagnostics. But the most interesting thing is to see how new diagnostic rules work and what errors they can find. It is very interesting to watch the tool catch more and more new defects in a project that seems to be cleaned out already. The next project we have re-checked is Clang.
ch5.ppt Operating System Ppt for ptu studentBhartiRani14
An operating system (OS) is software that manages computer hardware and provides services for computer programs. It serves as an intermediary between users and the computer's hardware, facilitating communication and coordination. Common examples include Windows, macOS, Linux, and Android. The OS handles tasks like memory management, file systems, security, and device communication, allowing users to interact with their devices in a user-friendly manner.
Wireless Communication and Networking by WilliamStallings Chap2Senthil Kanth
Hai I'm Senthilkanth, doing MCA in Mepco Schlenk Engineering College..
The following presentation covers topic called Wireless Communication and Networking
by WilliamStallings for BSc CS, BCA, MSc CS, MCA, ME students.Make use of it.
Wireless Communication and Networking
by WilliamStallings Chapter : 2Transmission Fundamentals
Chapter 2
Electromagnetic Signal
Function of time
Can also be expressed as a function of frequency
Signal consists of components of different frequencies
Time-Domain Concepts
Analog signal - signal intensity varies in a smooth fashion over time
No breaks or discontinuities in the signal
Digital signal - signal intensity maintains a constant level for some period of time and then changes to another constant level
Periodic signal - analog or digital signal pattern that repeats over time
s(t +T ) = s(t ) -¥< t < +¥
where T is the period of the signal
Time-Domain Concepts
Aperiodic signal - analog or digital signal pattern that doesn't repeat over time
Peak amplitude (A) - maximum value or strength of the signal over time; typically measured in volts
Frequency (f )
Rate, in cycles per second, or Hertz (Hz) at which the signal repeats
Time-Domain Concepts
Period (T ) - amount of time it takes for one repetition of the signal
T = 1/f
Phase () - measure of the relative position in time within a single period of a signal
Wavelength () - distance occupied by a single cycle of the signal
Or, the distance between two points of corresponding phase of two consecutive cycles
Sine Wave Parameters
General sine wave
s(t ) = A sin(2ft + )
Figure 2.3 shows the effect of varying each of the three parameters
(a) A = 1, f = 1 Hz, = 0; thus T = 1s
(b) Reduced peak amplitude; A=0.5
(c) Increased frequency; f = 2, thus T = ½
(d) Phase shift; = /4 radians (45 degrees)
note: 2 radians = 360° = 1 period
Sine Wave Parameters
Time vs. Distance
When the horizontal axis is time, as in Figure 2.3, graphs display the value of a signal at a given point in space as a function of time
With the horizontal axis in space, graphs display the value of a signal at a given point in time as a function of distance
At a particular instant of time, the intensity of the signal varies as a function of distance from the source
Frequency-Domain Concepts
Fundamental frequency - when all frequency components of a signal are integer multiples of one frequency, it’s referred to as the fundamental frequency
Spectrum - range of frequencies that a signal contains
Absolute bandwidth - width of the spectrum of a signal
Effective bandwidth (or just bandwidth) - narrow band of frequencies that most of the signal’s energy is contained in
Frequency-Domain Concepts
Any electromagnetic signal can be shown to consist of a collection of periodic analog signals (sine waves) at different amplitudes, frequencies, and phases
The period of the total signal is equal to the period of the fundamenta
wireless communication and networking Chapter 1Senthil Kanth
wireless communication and networking by WilliamStallings
Hai I'm Senthilkanth, doing MCA in Mepco Schlenk Engineering College..
The following presentation covers topic called Wireless Communication and Networking
by WilliamStallings for BSc CS, BCA, MSc CS, MCA, ME students.Make use of it.
This presentation agenda like,,
Introduction
Chapter 1: Wireless Comes of Age
Chapter 2: Transmission Fundamentals
Chapter 3: Communication Networks
Chapter 4: Protocols and the TCP/IP Protocol Suite
Chapter 5: Antennas and Propagation
Chapter 6: Signal Encoding Techniques
Chapter 7: Spread Spectrum
Chapter 8: Coding and Error Control
Chapter 9: Satellite Communications
Chapter 10: Cellular Wireless Networks
Chapter 11: Cordless Systems and Wireless Local Loop
Chapter 12: Mobile IP and Wireless Access Protocol
Chapter 13: Wireless LAN Technology
Chapter 14: IEEE 802.11 Wireless LAN Standard
Chapter 15: Bluetooth
Hai I'm Senthilkanth, doing MCA in Mepco Schlenk Engineering College..
The following presentation covers topic called WML for BSc CS, BCA, MSc CS, MCA, ME students.Make use of it. WML Script by Shanti katta.
This presentation agenda like,
WAP- Wireless Application Protocol
by
Team 11 Presenters:
Suma Pramod Connie Barbosa
Niti Pandey Patrick Cunning
Olga Pavlenko
This ppt contains the topic like,,
WAP Introduction,
WAP architecture requirements,
Architecture overview,
World-wide web model,
WAP model,
Components of WAP architecture,
Sample Configuration of WAP technology,
Usage, Advantages & Disadvantages of WAP,
Wireless Application Protocol (WAP),
Wireless Markup Language (WML),
Generating WML with XSLT,
WAP Emulator.
Presentation on WAP Keerti Sharma
This ppt contains the topic like,,
What is WAP ?
Limitations of Internet for wireless applications
WAP Architecture / protocol stack
WAP Components / WML
WAP brings Internet to hand-held devices
Conclusion
Introduction to Mobile Application DevelopmentSenthil Kanth
Introduction to Mobile Application Development
This ppt contains the topic like,,
WAP Network Structure,
The WAP Gateway plays an important role,
WAP Programming Model,
WML Example,
Java Platform,
Java 2 Platform,
Virtual Machines and horizontal and vertical APIs specified in configurations and Profiles,
Configurations
Introduction to wireless application protocol (wap)ogiSenthil Kanth
Introduction to wireless application protocol (wap)ogi Presented by
Dragomanov Andon
Paunovski Ognen
This ppt contains the topic like,,
What is WAP?
Development and Objectives
WAP Concept
WAP 1.0 Architecture
WAP 2.0 Architecture
WAP 2.0 Features
WML
Real Life Examples
Routing protocols for mobile ad-hoc networks have to
face the challenge of frequently changing topology, low
transmission power and asymmetric links. Both
proactive and reactive routing protocols prove to be
inefficient under these circumstances. The Zone Routing
Protocol (ZRP) combines the advantages of the proactive
and reactive approaches by maintaining an up-to-date
topological map of a zone centered on each node. Within
the zone, routes are immediately available. For
destinations outside the zone, ZRP employs a route
discovery procedure, which can benefit from the local
routing information of the zones.
On-Demand Multicast Routing Protocol.
This paper presents a novel multicast routing protocol for mobile ad hoc wireless networks. The protocol, termed ODMRP (On-Demand Multicast Routing Protocol), is a mesh-based, rather than a conventional tree- based, multicast scheme and uses a forwarding group concept (only a sub- set of nodes forwards the multicast packets via scoped flooding). It applies on-demand procedures to dynamically build routes and maintain multicast group membership. ODMRP is well suited for ad hoc wireless networks with mobile hosts where bandwidth is limited, topology changes frequently, and power is constrained. We evaluate ODMRP’s scalability and performance via simulation.
Routing Protocols for Ad-Hoc Networks. This is a book for Ad-hoc On-Demand Distance Vector Routing
&
DSR: The Dynamic Source Routing Protocol for Multi-Hop Wireless Ad Hoc Networks. November 2011,
Authors : Giorgos Papadakis & Manolis Surligas
Senthilkanth,MCA..
The following ppt's full topic covers Operating System for BSc CS, BCA, MSc CS, MCA students..
1.Introduction
2.OS Structures
3.Process
4.Threads
5.CPU Scheduling
6.Process Synchronization
7.Dead Locks
8.Memory Management
9.Virtual Memory
10.File system Interface
11.File system implementation
12.Mass Storage System
13.IO Systems
14.Protection
15.Security
16.Distributed System Structure
17.Distributed File System
18.Distributed Co Ordination
19.Real Time System
20.Multimedia Systems
21.Linux
22.Windows
Biological screening of herbal drugs: Introduction and Need for
Phyto-Pharmacological Screening, New Strategies for evaluating
Natural Products, In vitro evaluation techniques for Antioxidants, Antimicrobial and Anticancer drugs. In vivo evaluation techniques
for Anti-inflammatory, Antiulcer, Anticancer, Wound healing, Antidiabetic, Hepatoprotective, Cardio protective, Diuretics and
Antifertility, Toxicity studies as per OECD guidelines
Operation “Blue Star” is the only event in the history of Independent India where the state went into war with its own people. Even after about 40 years it is not clear if it was culmination of states anger over people of the region, a political game of power or start of dictatorial chapter in the democratic setup.
The people of Punjab felt alienated from main stream due to denial of their just demands during a long democratic struggle since independence. As it happen all over the word, it led to militant struggle with great loss of lives of military, police and civilian personnel. Killing of Indira Gandhi and massacre of innocent Sikhs in Delhi and other India cities was also associated with this movement.
Honest Reviews of Tim Han LMA Course Program.pptxtimhan337
Personal development courses are widely available today, with each one promising life-changing outcomes. Tim Han’s Life Mastery Achievers (LMA) Course has drawn a lot of interest. In addition to offering my frank assessment of Success Insider’s LMA Course, this piece examines the course’s effects via a variety of Tim Han LMA course reviews and Success Insider comments.
The Roman Empire A Historical Colossus.pdfkaushalkr1407
The Roman Empire, a vast and enduring power, stands as one of history's most remarkable civilizations, leaving an indelible imprint on the world. It emerged from the Roman Republic, transitioning into an imperial powerhouse under the leadership of Augustus Caesar in 27 BCE. This transformation marked the beginning of an era defined by unprecedented territorial expansion, architectural marvels, and profound cultural influence.
The empire's roots lie in the city of Rome, founded, according to legend, by Romulus in 753 BCE. Over centuries, Rome evolved from a small settlement to a formidable republic, characterized by a complex political system with elected officials and checks on power. However, internal strife, class conflicts, and military ambitions paved the way for the end of the Republic. Julius Caesar’s dictatorship and subsequent assassination in 44 BCE created a power vacuum, leading to a civil war. Octavian, later Augustus, emerged victorious, heralding the Roman Empire’s birth.
Under Augustus, the empire experienced the Pax Romana, a 200-year period of relative peace and stability. Augustus reformed the military, established efficient administrative systems, and initiated grand construction projects. The empire's borders expanded, encompassing territories from Britain to Egypt and from Spain to the Euphrates. Roman legions, renowned for their discipline and engineering prowess, secured and maintained these vast territories, building roads, fortifications, and cities that facilitated control and integration.
The Roman Empire’s society was hierarchical, with a rigid class system. At the top were the patricians, wealthy elites who held significant political power. Below them were the plebeians, free citizens with limited political influence, and the vast numbers of slaves who formed the backbone of the economy. The family unit was central, governed by the paterfamilias, the male head who held absolute authority.
Culturally, the Romans were eclectic, absorbing and adapting elements from the civilizations they encountered, particularly the Greeks. Roman art, literature, and philosophy reflected this synthesis, creating a rich cultural tapestry. Latin, the Roman language, became the lingua franca of the Western world, influencing numerous modern languages.
Roman architecture and engineering achievements were monumental. They perfected the arch, vault, and dome, constructing enduring structures like the Colosseum, Pantheon, and aqueducts. These engineering marvels not only showcased Roman ingenuity but also served practical purposes, from public entertainment to water supply.
Instructions for Submissions thorugh G- Classroom.pptxJheel Barad
This presentation provides a briefing on how to upload submissions and documents in Google Classroom. It was prepared as part of an orientation for new Sainik School in-service teacher trainees. As a training officer, my goal is to ensure that you are comfortable and proficient with this essential tool for managing assignments and fostering student engagement.
A Strategic Approach: GenAI in EducationPeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
Read| The latest issue of The Challenger is here! We are thrilled to announce that our school paper has qualified for the NATIONAL SCHOOLS PRESS CONFERENCE (NSPC) 2024. Thank you for your unwavering support and trust. Dive into the stories that made us stand out!
The French Revolution, which began in 1789, was a period of radical social and political upheaval in France. It marked the decline of absolute monarchies, the rise of secular and democratic republics, and the eventual rise of Napoleon Bonaparte. This revolutionary period is crucial in understanding the transition from feudalism to modernity in Europe.
For more information, visit-www.vavaclasses.com
Francesca Gottschalk - How can education support child empowerment.pptxEduSkills OECD
Francesca Gottschalk from the OECD’s Centre for Educational Research and Innovation presents at the Ask an Expert Webinar: How can education support child empowerment?
2. 6.2 Silberschatz, Galvin and GagneOperating System Concepts
Module 6: Process SynchronizationModule 6: Process Synchronization
Background
The Critical-Section Problem
Peterson’s Solution
Synchronization Hardware
Semaphores
Classic Problems of Synchronization
Monitors
Synchronization Examples
Atomic Transactions
3. 6.3 Silberschatz, Galvin and GagneOperating System Concepts
BackgroundBackground
Concurrent access to shared data may result in data
inconsistency
Maintaining data consistency requires mechanisms to
ensure the orderly execution of cooperating processes
Suppose that we wanted to provide a solution to the
consumer-producer problem that fills all the buffers. We
can do so by having an integer count that keeps track of
the number of full buffers. Initially, count is set to 0. It is
incremented by the producer after it produces a new
buffer and is decremented by the consumer after it
consumes a buffer.
4. 6.4 Silberschatz, Galvin and GagneOperating System Concepts
ProducerProducer
while (true)
/* produce an item and put in nextProduced
while (count == BUFFER_SIZE)
; // do nothing
buffer [in] = nextProduced;
in = (in + 1) % BUFFER_SIZE;
count++;
}
5. 6.5 Silberschatz, Galvin and GagneOperating System Concepts
ConsumerConsumer
while (1)
{
while (count == 0)
; // do nothing
nextConsumed = buffer[out];
out = (out + 1) % BUFFER_SIZE;
count--;
/* consume the item in nextConsumed
}
7. 6.7 Silberschatz, Galvin and GagneOperating System Concepts
Solution to Critical-Section ProblemSolution to Critical-Section Problem
1. Mutual Exclusion - If process Pi is executing in its critical section,
then no other processes can be executing in their critical sections
2. Progress - If no process is executing in its critical section and
there exist some processes that wish to enter their critical section,
then the selection of the processes that will enter the critical
section next cannot be postponed indefinitely
3. Bounded Waiting - A bound must exist on the number of times
that other processes are allowed to enter their critical sections
after a process has made a request to enter its critical section and
before that request is granted
Assume that each process executes at a nonzero speed
No assumption concerning relative speed of the N processes
8. 6.8 Silberschatz, Galvin and GagneOperating System Concepts
Peterson’s SolutionPeterson’s Solution
Two process solution
Assume that the LOAD and STORE instructions are atomic;
that is, cannot be interrupted.
The two processes share two variables:
int turn;
Boolean flag[2]
The variable turn indicates whose turn it is to enter the
critical section.
The flag array is used to indicate if a process is ready to
enter the critical section. flag[i] = true implies that process Pi
is ready!
9. 6.9 Silberschatz, Galvin and GagneOperating System Concepts
Algorithm for ProcessAlgorithm for Process PPii
do {
flag[i] = TRUE;
turn = j;
while ( flag[j] && turn == j);
CRITICAL SECTION
flag[i] = FALSE;
REMAINDER SECTION
} while (TRUE);
10. 6.10 Silberschatz, Galvin and GagneOperating System Concepts
Synchronization HardwareSynchronization Hardware
Many systems provide hardware support for critical section
code
Uniprocessors – could disable interrupts
Currently running code would execute without
preemption
Generally too inefficient on multiprocessor systems
Operating systems using this not broadly scalable
Modern machines provide special atomic hardware
instructions
Atomic = non-interruptable
Either test memory word and set value
Or swap contents of two memory words
12. 6.12 Silberschatz, Galvin and GagneOperating System Concepts
Solution using TestAndSetSolution using TestAndSet
Shared boolean variable lock., initialized to false.
Solution:
do {
while ( TestAndSet (&lock ))
; /* do nothing
// critical section
lock = FALSE;
// remainder section
} while ( TRUE);
14. 6.14 Silberschatz, Galvin and GagneOperating System Concepts
Solution using SwapSolution using Swap
Shared Boolean variable lock initialized to FALSE; Each
process has a local Boolean variable key.
Solution:
do {
key = TRUE;
while ( key == TRUE)
Swap (&lock, &key );
// critical section
lock = FALSE;
// remainder section
} while ( TRUE);
15. 6.15 Silberschatz, Galvin and GagneOperating System Concepts
SemaphoreSemaphore
Synchronization tool that does not require busy waiting
Semaphore S – integer variable
Two standard operations modify S: wait() and signal()
Originally called P() and V()
Less complicated
Can only be accessed via two indivisible (atomic) operations
wait (S) {
while S <= 0
; // no-op
S--;
}
signal (S) {
S++;
}
16. 6.16 Silberschatz, Galvin and GagneOperating System Concepts
Semaphore as General Synchronization ToolSemaphore as General Synchronization Tool
Counting semaphore – integer value can range over an unrestricted
domain
Binary semaphore – integer value can range only between 0
and 1; can be simpler to implement
Also known as mutex locks
Can implement a counting semaphore S as a binary semaphore
Provides mutual exclusion
Semaphore S; // initialized to 1
wait (S);
Critical Section
signal (S);
17. 6.17 Silberschatz, Galvin and GagneOperating System Concepts
Semaphore ImplementationSemaphore Implementation
Must guarantee that no two processes can execute wait () and
signal () on the same semaphore at the same time
Thus, implementation becomes the critical section problem
where the wait and signal code are placed in the crtical section.
Could now have busy waiting in critical section
implementation
But implementation code is short
Little busy waiting if critical section rarely occupied
Note that applications may spend lots of time in critical sections
and therefore this is not a good solution.
18. 6.18 Silberschatz, Galvin and GagneOperating System Concepts
Semaphore Implementation with no Busy waitingSemaphore Implementation with no Busy waiting
With each semaphore there is an associated waiting queue.
Each entry in a waiting queue has two data items:
value (of type integer)
pointer to next record in the list
Two operations:
block – place the process invoking the operation on the
appropriate waiting queue.
wakeup – remove one of processes in the waiting queue
and place it in the ready queue.
19. 6.19 Silberschatz, Galvin and GagneOperating System Concepts
Semaphore Implementation with no Busy waitingSemaphore Implementation with no Busy waiting
(Cont.)(Cont.)
Implementation of wait:
wait (S){
value--;
if (value < 0) {
add this process to waiting queue
block(); }
}
Implementation of signal:
Signal (S){
value++;
if (value <= 0) {
remove a process P from the waiting queue
wakeup(P); }
}
20. 6.20 Silberschatz, Galvin and GagneOperating System Concepts
Deadlock and StarvationDeadlock and Starvation
Deadlock – two or more processes are waiting indefinitely for an
event that can be caused by only one of the waiting processes
Let S and Q be two semaphores initialized to 1
P0 P1
wait (S); wait (Q);
wait (Q); wait (S);
. .
. .
. .
signal (S); signal (Q);
signal (Q); signal (S);
Starvation – indefinite blocking. A process may never be removed
from the semaphore queue in which it is suspended.
21. 6.21 Silberschatz, Galvin and GagneOperating System Concepts
Classical Problems ofClassical Problems of
SynchronizationSynchronization
Bounded-Buffer Problem
Readers and Writers Problem
Dining-Philosophers Problem
22. 6.22 Silberschatz, Galvin and GagneOperating System Concepts
Bounded-Buffer ProblemBounded-Buffer Problem
N buffers, each can hold one item
Semaphore mutex initialized to the value 1
Semaphore full initialized to the value 0
Semaphore empty initialized to the value N.
23. 6.23 Silberschatz, Galvin and GagneOperating System Concepts
Bounded Buffer Problem (Cont.)Bounded Buffer Problem (Cont.)
The structure of the producer process
do {
// produce an item
wait (empty);
wait (mutex);
// add the item to the buffer
signal (mutex);
signal (full);
} while (true);
24. 6.24 Silberschatz, Galvin and GagneOperating System Concepts
Bounded Buffer Problem (Cont.)Bounded Buffer Problem (Cont.)
The structure of the consumer process
do {
wait (full);
wait (mutex);
// remove an item from buffer
signal (mutex);
signal (empty);
// consume the removed item
} while (true);
25. 6.25 Silberschatz, Galvin and GagneOperating System Concepts
Readers-Writers ProblemReaders-Writers Problem
A data set is shared among a number of concurrent processes
Readers – only read the data set; they do not perform any
updates
Writers – can both read and write.
Problem – allow multiple readers to read at the same time. Only
one single writer can access the shared data at the same time.
Shared Data
Data set
Semaphore mutex initialized to 1.
Semaphore wrt initialized to 1.
Integer readcount initialized to 0.
26. 6.26 Silberschatz, Galvin and GagneOperating System Concepts
Readers-Writers Problem (Cont.)Readers-Writers Problem (Cont.)
The structure of a writer process
do {
wait (wrt) ;
// writing is performed
signal (wrt) ;
} while (true)
27. 6.27 Silberschatz, Galvin and GagneOperating System Concepts
Readers-Writers Problem (Cont.)Readers-Writers Problem (Cont.)
The structure of a reader process
do {
wait (mutex) ;
readcount ++ ;
if (readercount == 1) wait (wrt) ;
signal (mutex)
// reading is performed
wait (mutex) ;
readcount - - ;
if redacount == 0) signal (wrt) ;
signal (mutex) ;
} while (true)
28. 6.28 Silberschatz, Galvin and GagneOperating System Concepts
Dining-Philosophers ProblemDining-Philosophers Problem
Shared data
Bowl of rice (data set)
Semaphore chopstick [5] initialized to 1
29. 6.29 Silberschatz, Galvin and GagneOperating System Concepts
Dining-Philosophers Problem (Cont.)Dining-Philosophers Problem (Cont.)
The structure of Philosopher i:
Do {
wait ( chopstick[i] );
wait ( chopStick[ (i + 1) % 5] );
// eat
signal ( chopstick[i] );
signal (chopstick[ (i + 1) % 5] );
// think
} while (true) ;
30. 6.30 Silberschatz, Galvin and GagneOperating System Concepts
Problems with SemaphoresProblems with Semaphores
Correct use of semaphore operations:
signal (mutex) …. wait (mutex)
wait (mutex) … wait (mutex)
Omitting of wait (mutex) or signal (mutex) (or both)
31. 6.31 Silberschatz, Galvin and GagneOperating System Concepts
MonitorsMonitors
A high-level abstraction that provides a convenient and effective
mechanism for process synchronization
Only one process may be active within the monitor at a time
monitor monitor-name
{
// shared variable declarations
procedure P1 (…) { …. }
…
procedure Pn (…) {……}
Initialization code ( ….) { … }
…
}
}
32. 6.32 Silberschatz, Galvin and GagneOperating System Concepts
Schematic view of a MonitorSchematic view of a Monitor
33. 6.33 Silberschatz, Galvin and GagneOperating System Concepts
Condition VariablesCondition Variables
condition x, y;
Two operations on a condition variable:
x.wait () – a process that invokes the operation is
suspended.
x.signal () – resumes one of processes (if any) tha
invoked x.wait ()
34. 6.34 Silberschatz, Galvin and GagneOperating System Concepts
Monitor with Condition VariablesMonitor with Condition Variables
35. 6.35 Silberschatz, Galvin and GagneOperating System Concepts
Solution to Dining PhilosophersSolution to Dining Philosophers
monitor DP
{
enum { THINKING; HUNGRY, EATING) state [5] ;
condition self [5];
void pickup (int i) {
state[i] = HUNGRY;
test(i);
if (state[i] != EATING) self [i].wait;
}
void putdown (int i) {
state[i] = THINKING;
// test left and right neighbors
test((i + 4) % 5);
test((i + 1) % 5);
}
36. 6.36 Silberschatz, Galvin and GagneOperating System Concepts
Solution to Dining Philosophers (cont)Solution to Dining Philosophers (cont)
void test (int i) {
if ( (state[(i + 4) % 5] != EATING) &&
(state[i] == HUNGRY) &&
(state[(i + 1) % 5] != EATING) ) {
state[i] = EATING ;
self[i].signal () ;
}
}
initialization_code() {
for (int i = 0; i < 5; i++)
state[i] = THINKING;
}
}
37. 6.37 Silberschatz, Galvin and GagneOperating System Concepts
Synchronization ExamplesSynchronization Examples
Solaris
Windows XP
Linux
Pthreads
38. 6.38 Silberschatz, Galvin and GagneOperating System Concepts
Solaris SynchronizationSolaris Synchronization
Implements a variety of locks to support multitasking,
multithreading (including real-time threads), and multiprocessing
Uses adaptive mutexes for efficiency when protecting data from
short code segments
Uses condition variables and readers-writers locks when longer
sections of code need access to data
Uses turnstiles to order the list of threads waiting to acquire either
an adaptive mutex or reader-writer lock
39. 6.39 Silberschatz, Galvin and GagneOperating System Concepts
Windows XP SynchronizationWindows XP Synchronization
Uses interrupt masks to protect access to global resources on
uniprocessor systems
Uses spinlocks on multiprocessor systems
Also provides dispatcher objects which may act as either mutexes
and semaphores
Dispatcher objects may also provide events
An event acts much like a condition variable
40. 6.40 Silberschatz, Galvin and GagneOperating System Concepts
Linux SynchronizationLinux Synchronization
Linux:
disables interrupts to implement short critical sections
Linux provides:
semaphores
spin locks
41. 6.41 Silberschatz, Galvin and GagneOperating System Concepts
Pthreads SynchronizationPthreads Synchronization
Pthreads API is OS-independent
It provides:
mutex locks
condition variables
Non-portable extensions include:
read-write locks
spin locks