• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 4 out of 68 pages
Class notes

Operating Systems: Chapter 5 to Chapter 9

Document preview thumbnail
Preview 4 out of 68 pages

This document looks at William Stallings, Operating Systems: Internals and Design Principles. Specifically Chapter 5 to Chapter 9. Chapter 5 - Concurrency: Mutual Exclusion and Synchronisation Chapter 6 - Concurrency: Deadlock and Starvation Chapter 7 - Memory Management Chapter 8 - Virtual Memory Chapter 9 - Uniprocessor Scheduling

Content preview

Chapter 5: Part 1
Concurrency: Mutual Exclusion and Synchronization (Section5.1-5.3)

Multiple Processes
o OS design in concerned with management of processes and threads
o Multiprogramming
 Management of multiple processes within a uniprocessor system
o Multiprocessing
 Management of multiple processes within a multiprocessor
o Distributed Processing
 Management of multiple processes executing on multiple, distributed
computer systems
 Example: recent proliferation of cluster

Concurrency in 3 different contexts
1. Multiple applications
o Purpose: allow processing time to be shared among active applications
2. Structured applications
o Extension of modular design and structures programming
3. Operating system structure (where the need arises)
o OS implemented as a set of processes/threads




Atomic operation, critical section, deadlock, livelock, mutual exclusion, race condition, starvation

,Mutual Exclusion: Software Approaches
o Software approaches can be implemented for concurrent processes that execute on a single-
processor/multiprocessor machine which shared main memory
o These approaches assume mutual exclusion at memory access level
o Simultaneous accesses (reading/writing) to the same location in memory is
serialized by some sort of memory arbiter, although the other of access granting in
not specified ahead of time
o No other support in hardware, OS or programming language is assumed
o Dijkstra (Computer Scientist) reported an algorithm for mutual exclusion for 2 processes,
designed by the Dutch mathematician Dekker
o Solutions were developed in stages
o Advantage: illustrating many common bugs encountered in developing concurrent
programs
o FLAWS




o Attempt1 – not suitable for concurrent
 P1 forced to wait until P0 requires access
 If 1 process fails, the others are permanently blocked
 Stored name when we need info




o Attemp2 – does not guarantee mutual exclusion
 Use Boolean vector flag – to keep track of process states and not block
others if 1 fails
 Flag[0] – process 0
 can check content of other process but can’t alter it
 false = proceed to critical section by setting itself to be true
 once left the critical section, set flag to false
 Possible to have 2 processes set as true (violates intent)
 if fails after set to true (just about enter critical section), then other
processes will be permanently blocked

, o Attempt3
 Once P0 has set flag to true, then P1 can’t entre critical section until the
other has left its critical section and set flag to false
 Guarantee mutual exclusion
 Problem: if both set to true at same time, then each process will block each
other, infinite loop – deadlock




o Attempt4
 Close but still flawed
 Mutual exclusion is guaranteed
 If both processes set their flags to be true at the same time, they check each
other in the while loop and each processes sets its flag to false. This is
happening SIMULTANEOUSLY (livelock – both carrying a meaningless
process)
 They are both asking each other to go through the door, persistently
o Correct
o Checks to see which of the 2 processes that have set themselves to true, has the most
insistent need to entre its critical section
o Make use of turn variable to say whether or not it’s the processes
turn to go
 0 = go
 1 = no
o Most correct
 It is clear to see that
it allows for mutual
exclusion
 It caters for all kinds
of locking
 Can be applied to
>2 processes

, Principles of concurrency
o Interleaving and overlapping
o Viewed as an example of concurrent processing
o Present the same problems
o Uniprocessor – relative speed of execution of processes can’t be predicted
o Depends on activities of other processes
o Way OS handles interrupts
o Scheduling policies of OS

Difficulty of concurrency
o Sharing of global resources
o Diff for OS to manage the allocation of resources optimally
o Diff to locate programming errors as results are not deterministic and reproducible

Race condition
o Occurs when multiple processes or threads read and write data items
o So that, the final result depends on the order of execution
o “loser” of the race is the process that updates last and will determine the final value
of the variable
o Example: varA gets a value from P1 but then P2 gives it a value, the loser (P2) will
determine the value of varA

Operating System concerns
o Design and management issues raised by existence of concurrency
o OS must:
o Be able to keep track of various processes
o Allocate and de-allocate resources for each active process
o Protect the data and physical resources of each process against unintended
interference by other processes
o Functioning of a process, and the output it produces, must be independent of the
speed at which its execution is carried out relative to the speed of other concurrent
processes




Process interaction:
Processes unaware, indirectly aware, and directly aware of each other

Connected book
 image
William Stallings Operating Systems
Publisher: 2014 ISBN: 9780133805918 Edition: Unknown

Document information

Uploaded on
November 8, 2021
File latest updated on
October 15, 2023
Number of pages
68
Written in
2021/2022
Type
Class notes
Professor(s)
Dr. s gruner & ms. eunice hammond
Contains
Lecture 12 to lecture 25
$6.21

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Sold
32
Followers
25
Items
23
Last sold
2 year ago




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

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions