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

Lecture Notes for IPC with and without busy waiting.

Rating
-
Sold
-
Pages
6
Uploaded on
27-06-2023
Written in
2022/2023

Details problems that are common in IPC and multiple ways we can fix them with and without busy waiting. Details: Lock Variables, Strict Alternation, Peterson Algorithm, Test and Set Lock, Sleep and Wakeup, Semaphores, Mutexes, Monitors, Barriers and Read-Copy-Update.

Show more Read less









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

Document information

Uploaded on
June 27, 2023
Number of pages
6
Written in
2022/2023
Type
Lecture notes
Professor(s)
Dr matteo sammartino
Contains
All classes

Subjects

Content preview

Week 3

Interprocess Communication (IPC)
Processes need to be able to communicate to:
-Pass information which is relevant for a given multiprocess task
-Prevent trying to access exclusive resources simultaneously
-Work with an appropriate sequencing of events when there are dependencies (eg if A can
only run then B is finished, then B must be running first)



Inter Thread
Threads share memory so they can communicate through this.
However, they also need to prevent trying to access resources simultaneously, and work
with appropriate sequencing.



Race Conditions
Takes place when two or more processes are reading or writing some shared data, the final
result depends on which processes are running when. This can happen with processes as
they have some shared stored such as main memory.



Mutual Exclusion
A technique commonly used to avoid RC. It identifies the parts of the program - called critical
regions - where processes access shared resources and ensure that these processes are
not in their critical regions at the same time.

Critical Region Rules:
1. No two processes may be simultaneously inside their critical regions
2. No assumptions may be made about speeds to the number of CPUs
3. No process running outside its critical region may block other processes
4. No process should have to wait forever to enter its critical region



IPC with Busy Waiting

Lock Variable
● Var shared among processes
● When value is 0, means no process is in critical region
● Before process enters critical region, must check the lock
● Busy waiting as the while loop is waiting for the lock to change

, This has a problem as another process can read the lock before the original one has
changed its value. This allows two processes to proceed to their critical regions.



Strict Alternation
● Two processes share a variable “turn”. Program starts with it set to 0
● The process will only be allowed to enter its critical region when the variable is set to
its turn. Eg process a can only perform its critical tasks when turn is 0
● After one process has left the critical region, the variable will be set to a different
value, allowing another process to enter cr
● Guarantees that no matter the order in which the two processes are scheduled,
they’ll never be in critical region at the same time
● Only reasonable to apply strict alternation when the time a process spends waiting is
short
○ If a process is much slower than the other one, the fast one will be blocked for
a long time whilst the slow one is still in its non-critical region and cannot set
“turn” back to the other process.
○ Doesn’t comply with the rule that no process running outside its critical region
may block other processes



Peterson Algorithm
Before entering a critical region, a process indicates its interest in entering but offers the
opportunity to another one first. It calls enter_region with its own id number and might have
to wait until it is safe to enter. After leaving the region, the process calls leave_region to
notify it is done.
£3.49
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
amyengelbrecht

Get to know the seller

Seller avatar
amyengelbrecht Royal Holloway University of London (South East)
View profile
Follow You need to be logged in order to follow users or courses
Sold
2
Member since
2 year
Number of followers
0
Documents
5
Last sold
9 months ago

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 exams and reviewed by others who've used these revision notes.

Didn't get what you expected? Choose another document

No problem! You can straightaway pick a different document that better suits what you're after.

Pay as you like, start learning straight 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 smashed it. It really can be that simple.”

Alisha Student

Frequently asked questions