Garantie de satisfaction à 100% Disponible immédiatement après paiement En ligne et en PDF Tu n'es attaché à rien 4,6 TrustPilot
logo-home
Notes de cours

Inter-process communication in operating systems

Note
-
Vendu
-
Pages
24
Publié le
30-12-2022
Écrit en
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

Montrer plus Lire moins
Établissement
Cours










Oups ! Impossible de charger votre document. Réessayez ou contactez le support.

École, étude et sujet

Établissement
Cours

Infos sur le Document

Publié le
30 décembre 2022
Nombre de pages
24
Écrit en
2021/2022
Type
Notes de cours
Professeur(s)
Ymk sir
Contenu
Toutes les classes

Sujets

Aperçu du contenu

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,05 €
Accéder à l'intégralité du document:

Garantie de satisfaction à 100%
Disponible immédiatement après paiement
En ligne et en PDF
Tu n'es attaché à rien

Faites connaissance avec le vendeur
Seller avatar
vaibhav51ppsv2020

Document également disponible en groupe

Faites connaissance avec le vendeur

Seller avatar
vaibhav51ppsv2020 C.K.Pithawala school of engineering and techonology
S'abonner Vous devez être connecté afin de pouvoir suivre les étudiants ou les formations
Vendu
0
Membre depuis
3 année
Nombre de followers
0
Documents
14
Dernière vente
-

0,0

0 revues

5
0
4
0
3
0
2
0
1
0

Récemment consulté par vous

Pourquoi les étudiants choisissent Stuvia

Créé par d'autres étudiants, vérifié par les avis

Une qualité sur laquelle compter : rédigé par des étudiants qui ont réussi et évalué par d'autres qui ont utilisé ce document.

Le document ne convient pas ? Choisis un autre document

Aucun souci ! Tu peux sélectionner directement un autre document qui correspond mieux à ce que tu cherches.

Paye comme tu veux, apprends aussitôt

Aucun abonnement, aucun engagement. Paye selon tes habitudes par carte de crédit et télécharge ton document PDF instantanément.

Student with book image

“Acheté, téléchargé et réussi. C'est aussi simple que ça.”

Alisha Student

Foire aux questions