Download presentation
Presentation is loading. Please wait.
1
Chien-Chung Shen CIS/UD cshen@udel.edu
Review of Final Exam Chien-Chung Shen CIS/UD
2
Semaphore Usage: Summary
Mutual exclusion: binary semaphore as mutex lock Controlled access to a given resource consisting of a finite number of instances: counting semaphore semaphore is initialized to the number of instances available Synchronization: two concurrent running threads T1 and T2 with statements S1 and S2, respectively require S2 be executed only after S1 has completed (on one CPU) Semaphore s = 0; T1: S1; signal(s); T2: wait(s); S2; S1 S2 T1 T2
3
Bounded Buffer Multiple P/C
4
Buddy Allocation search for free space recursively divides free space by two until a block that is big enough to accommodate the request is found (William Stallings: OS)
5
$ ln Chapter3 Chapter3.hard $ ls –il (show attributes of files)
two names for the same file $ ln Chapter3 Chapter3.hard $ ls –il (show attributes of files)
6
Get Info about Files [cisc361:/usa/cshen/ ] echo hello > foo [cisc361:/usa/cshen/ ] more foo hello [cisc361:/usa/cshen/ ] stat foo File: 'foo' Size: 6 Blocks: 3 IO Block: regular file Device: 29h/41d Inode: Links: 1 Access: (0664/-rw-rw-r--) Uid: ( 4157/ cshen) Gid: ( 4157/ cshen) Access: :06: Modify: :08: Change: :08: Birth: - [cisc361:/usa/cshen/ ] ls -i foo 73985 foo [cisc361:/usa/cshen/ ] All info of each file is stored in the inode (persistent) structure
7
Soft/Symbolic Links $ ln –s Chapter3 Chapter3.soft Soft link is a file itself containing “pathname” for the file that the link file is a symbolic link to 3 files types regular file (-) directory (d) symbolic link (l)
8
Symbolic (Soft) Links A symbolic link is actually a file itself, of a different type, containing the pathname of the linked-to file d: directory -: regular file l: symbolic link Possible of dangling reference
9
Fundamental Issues A, B, and C are located at the angles of an isosceles triangle A lights up a torch upon seeing the flare, B and C press buzzers what would A, B, and C hear? observers’ views of the global state of the system depend on the observation points reason: non-instantaneous communications One fundamental issue of distributed system is lack of a global system state Two different watches real clocks drift A B C 12:01PM 11:57AM 9:00AM after 3 hours
10
Fundamental Issues Since we cannot count on simultaneous observations of global states in distributed systems, we need to find a property on which we can depend Distributed systems are causal the cause precedes the effect sending of a message precedes the receipt of the message
11
time Space-Time diagram p1 and r4? p3 and q3? concurrent causal
12
time
13
Lamport Timestamps Example
Events occurring at three processors local logical clocks are initialized to 0 2 3 7 1 6 4 3 1 5
14
Round Robin Instead of running jobs to completion, RR runs a job for a (small) time slice (scheduling quantum) and switches to the next job in the ready queue; repeatedly does so until jobs are finished Time slicing – length of time slice = multiple of timer-interrupt period SJF response time = 5 RR response time = 1 Length of time slice is critical under response time, the shorter the better too short, overhead of context switching dominates
15
Incorporating I/O Process is blocked waiting for I/O completion
When I/O completes, an interrupt is raised, and OS runs and moves the process that issued the I/O from blocked state back to ready state Poor use of CPU Overlap CPU & I/O higher CPU utilization Interactive jobs get run frequently; while they are performing I/O, other CPU-intensive jobs run job B has no I/O
16
Summary – History is the Guide
Rule 1: If Priority(A) > Priority(B), A runs (B doesn’t) Rule 2: If Priority(A) = Priority(B), A & B run in RR Rule 3: When a job enters the system, it is placed at the highest priority (the topmost queue) Rule 4: Once a job uses up its time allotment at a given level (regardless of how many times it has given up the CPU), its priority is reduced (i.e., it moves down one queue) Rule 5: After some time period S, move all the jobs in the system to the topmost queue Instead of demanding a priori knowledge of a job, it instead observes the execution of a job and prioritizes it accordingly It manages to achieve the best of both worlds: it can deliver excellent overall performance (similar to SJF/STCF) for interactive jobs, and is fair and makes progress for long-running CPU-intensive workloads
17
Working Set When memory is simply oversubscribed (or memory demands of the set of running processes exceeds the available physical memory), the system will constantly be paging - thrashing Working set W(t, Δ) = the set of pages that a process has been referencing in the last Δ virtual time units Admission control - given a set of processes, system decides not to run a subset of processes, with the hope that the reduced set of processes working sets (the pages that they are using actively) fit in memory and thus can make progress time
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.