100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Class notes

Inter-process communication in operating systems

Rating
-
Sold
-
Pages
24
Uploaded on
30-12-2022
Written in
2021/2022

In these notes, Covered all the topics of operating systems briefly. COs - Analyze the structure of OS and basic architectural components involved in OS design. Compare and contrast various CPU scheduling algorithms. Evaluate the requirements for the process synchronization and co-ordination in the contemporary operating system. Analyze various algorithms for memory management, I/O management and security aspects of operating system. Write shell scripts in Unix/Linux O.S and write simple programs using kernel system calls. Also understand virtualization concept

Show more Read less
Institution
Course










Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
Course

Document information

Uploaded on
December 30, 2022
Number of pages
24
Written in
2021/2022
Type
Class notes
Professor(s)
Ymk sir
Contains
All classes

Subjects

Content preview

3 – IPC

(1) Define following terms.
Race Condition
• Race condition can be defined as situation where two or more processes are reading
or writing some shared data and the final result depends on who runs precisely
when (their relative execution order).
Mutual Exclusion
• It is a way of making sure that if one process is using a shared variable or file; the
other process will be excluded (stopped) from doing the same thing.
Turnaround Time
• Time required to complete execution of process is known as turnaround time.
• Turnaround time = Process finish time – Process arrival time.
Throughput
• Number of processes completed per time unit is called throughput.
Critical Section
• The part of program or code of segment of a process where the shared resource is
accessed is called critical section.
Waiting time
• It is total time duration spent by a process waiting in ready queue.
• Waiting time = Turnaround time – Actual execution time.
Response Time
• It is the time between issuing a command/request and getting output/result.


(2) Explain different mechanisms for achieving mutual exclusion with busy waiting.
Disabling interrupts
• In this mechanism a process disables interrupts before entering the critical section
and enables the interrupt immediately after exiting the critical section.
while( true )
{
< disable interrupts >;
< critical section >;
< enable interrupts >;
< remainder section>; }

1

, 3 – IPC
• Mutual exclusion is achieved because with interrupts disabled, no clock interrupts
can occur.
• The CPU is only switched from process to process as a result of clock or other
interrupts, and with interrupts turned off the CPU will not be switched to another
process.
• Thus, once a process has disabled interrupts, it can examine and update the shared
memory without fear that any other process will intervene.
• This approach is generally unattractive because it is unwise to give user processes
the power to turn off interrupts.
• Suppose that one of them did it and never turned them on again? That could be the
end of the system.
• Furthermore if the system is a multiprocessor, with two or more CPUs, disabling
interrupts affects only the CPU that executed the disable instruction. The other ones
will continue running and can access the shared memory.
• On the other hand, it is frequently convenient for the kernel itself to disable
interrupts for a few instructions while it is updating variables or lists.
• If an interrupt occurred while the list of ready processes, for example, was in an
inconsistent state, race conditions could occur.
• The conclusion is: disabling interrupts is often a useful technique within the
operating system itself but is not appropriate as a general mutual exclusion
mechanism for user processes.


Shared lock variable:
• In this mechanism there is a shared variable lock having value 0 or 1.
• Before entering in to critical region a process check a shared variable lock’s value.
• If the value of lock is 0 then set it to 1 before entering the critical section and enters
into critical section and set it to 0 immediately after leaving the critical section.
While (true)
{
< set shared variable to 1>;
< critical section >;
< set shared variable to 0>;
< remainder section>;
}



2

, 3 – IPC
• If it is 1, means some other process is inside the critical section so, the process
requesting to enter the critical region will have to wait until it becomes zero.
• This mechanism suffers the same problem (race condition). If process P0 sees the
value of lock variable 0 and before it can set it to 1, context switching occurs.
• Now process P1 runs and finds value of lock variable 0, so it sets value to 1, enters
critical region.
• At the same point of time P0 resumes, sets the value of lock variable to 1, enters
critical region.
• Now two processes are in their critical regions accessing the same shared memory,
which violates the mutual exclusion condition.


Strict Alteration:




Process 1 Process 2
• In this proposed solution, the integer variable 'turn' keeps track of whose turn is to
enter the critical section.
• Initially turn=0. Process 1 inspects turn, finds it to be 0, and enters in its critical
section. Process 2 also finds it to be 0 and therefore sits in a loop continually testing
'turn' to see when it becomes 1.
• Continuously testing a variable waiting for some value to appear is called the busy
waiting.
• When process 1 exit from critical region it set turn to 1 and now process 2 can find it
to be 1 and enters in to critical region.
• In this way both the process get alternate turn to enter in critical region.
• Taking turns is not a good idea when one of the processes is much slower than the
other.
• Consider the following situation for two processes P0 and P1


3
$5.19
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached

Get to know the seller
Seller avatar
vaibhav51ppsv2020

Also available in package deal

Get to know the seller

Seller avatar
vaibhav51ppsv2020 C.K.Pithawala school of engineering and techonology
Follow You need to be logged in order to follow users or courses
Sold
0
Member since
3 year
Number of followers
0
Documents
14
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions