5. Parallelism is the quality of occurring at the same timeParallelism is the quality of occurring at the same time
Two tasks are parallel if they are performed at the same time
6. Concurrency is an illusion of parallelism.Concurrency is an illusion of parallelism.
10. Process 1:
Process 2:
Concurrency in Single processor systemConcurrency in Single processor system
Figure:Figure: Concurrent processing in Uniprocessor system
Time
Process 2:
Process 3:
11. Modern Operating Systems are multiprocessor systems.Modern Operating Systems are multiprocessor systems.
They run many process concurrently to achieve better resource utilization.They run many process concurrently to achieve better resource utilization.
12. Concurrent processing in Multiprocessor systemConcurrent processing in Multiprocessor system
Time
17. P0:
Read(A);
A = A – 100;
Write(A);
P1:
Read(A);
A = A + 200;
Write(A);
P0:
Read(A);
A = A – 100;
Write(A);
P1:
Read(A);
A = A + 200;
Write(A);
P0:
Read(A);
A = A – 100;
Write(A);
P1:
Read(A);
A = A + 200;
Write(A);
P0:
Read(A);
A = A – 100;
Write(A);
P1:
Read(A);
A = A + 200;
Write(A);
18.
19.
20.
21. Critical section refers to the code segment of a process, whereby itCritical section refers to the code segment of a process, whereby it
accesses a shared resourceaccesses a shared resource
40. int turn = 0; /* Initial value of turn can be set to 0 or 1*/
P0:P0:
do{
while (turn == 1); /* Keep looping as long as turn equals 1*/
/* This is entry section*/
<Critical Section><Critical Section>
turn = 1; /*Enable P1 to enter Critical Section*/
/*This is exit section*/
<Remainder Section><Remainder Section>
}while(1);
P1:P1:
do{
while (turn == 0); /* Keep looping as long as turn equals 0*/
/* This is the entry section*/
<Critical Section><Critical Section>
turn = 0; /*Enable P0 to enter Critical Section*/
/*This is the exit section*/
<Remainder Section><Remainder Section>
}while(1);