Final review. From threads to file systems

Similar documents
Synchronization II. Today. ! Condition Variables! Semaphores! Monitors! and some classical problems Next time. ! Deadlocks

Synchronization II. q Condition Variables q Semaphores and monitors q Some classical problems q Next time: Deadlocks

W4118 Operating Systems. Instructor: Junfeng Yang

Synchroniza+on II COMS W4118

Semaphores Semaphores: A Definition

Condition Variables CS 241. Prof. Brighten Godfrey. March 16, University of Illinois

C09: Process Synchronization

[537] Concurrency Bugs. Tyler Harter

Midterm Exam. October 20th, Thursday NSC

Semaphores. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

CS-537: Midterm Exam (Fall 2013) Professor McFlub

Operating Systems. Lecture 4 - Concurrency and Synchronization. Master of Computer Science PUF - Hồ Chí Minh 2016/2017

Operating Systems. Thread Synchronization Primitives. Thomas Ropars.

Main Points of the Computer Organization and System Software Module

Architectural Support. Processes. OS Structure. Threads. Scheduling. CSE 451: Operating Systems Spring Module 28 Course Review

Introduction to Operating Systems

CS-537: Midterm Exam (Spring 2001)

CS 4410 Operating Systems. Review 1. Summer 2016 Cornell University

Condition Variables. parent: begin child parent: end

Using Semaphores CS 241. March 14, University of Illinois

Lecture 9: Midterm Review

Semaphores. attention to the previous chapters. And even remembering a few things. You have, right?!

CSI3131 Final Exam Review

To Everyone... iii To Educators... v To Students... vi Acknowledgments... vii Final Words... ix References... x. 1 ADialogueontheBook 1

CSE Traditional Operating Systems deal with typical system software designed to be:

Synchronization. CSE 2431: Introduction to Operating Systems Reading: Chapter 5, [OSC] (except Section 5.10)

CS4411 Intro. to Operating Systems Final Fall points 12 pages

Operating Systems EDA092, DIT 400 Exam

148 PROCESSES CHAP. 2

b. How many bits are there in the physical address?

Chapter 6: Process Synchronization

Timers 1 / 46. Jiffies. Potent and Evil Magic

Threads. Concurrency. What it is. Lecture Notes Week 2. Figure 1: Multi-Threading. Figure 2: Multi-Threading

Caching and reliability

Page 1. Goals for Today" Atomic Read-Modify-Write instructions" Examples of Read-Modify-Write "

Synchronization Principles I

Mid-term Roll no: Scheduler Activations: Effective Kernel Support for the User-Level Management of Parallelism

[537] Semaphores. Tyler Harter

CSE 4/521 Introduction to Operating Systems

Concurrent & Distributed Systems Supervision Exercises

Module 6: Process Synchronization

Suggested Solutions (Midterm Exam October 27, 2005)

Chapter 6: Process Synchronization. Operating System Concepts 8 th Edition,

Multiprocessor Systems. Chapter 8, 8.1

Process Synchronization

CS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring Lecture 8: Semaphores, Monitors, & Condition Variables

Process Synchronization: Semaphores. CSSE 332 Operating Systems Rose-Hulman Institute of Technology

Threads. Threads The Thread Model (1) CSCE 351: Operating System Kernels Witawas Srisa-an Chapter 4-5

Semaphores Semaphores: A Definition

CSE 451: Operating Systems Winter Lecture 7 Synchronization. Hank Levy 412 Sieg Hall

CS370 Operating Systems

Note: The following (with modifications) is adapted from Silberschatz (our course textbook), Project: Producer-Consumer Problem.

Page 1. Goals for Today" Atomic Read-Modify-Write instructions" Examples of Read-Modify-Write "

Concurrency. Chapter 5

CS Operating Systems

CS Operating Systems

CS-537: Midterm Exam (Fall 2013) Professor McFlub: The Solutions Edition

EECE.4810/EECE.5730: Operating Systems Spring Midterm Exam March 8, Name: Section: EECE.4810 (undergraduate) EECE.

Operating Systems. Designed and Presented by Dr. Ayman Elshenawy Elsefy

Synchronization. Disclaimer: some slides are adopted from the book authors slides 1

SYNCHRONIZATION M O D E R N O P E R A T I N G S Y S T E M S R E A D 2. 3 E X C E P T A N D S P R I N G 2018

Sistemas Operacionais I. Valeria Menezes Bastos

CHAPTER 6: PROCESS SYNCHRONIZATION

Semaphore. Originally called P() and V() wait (S) { while S <= 0 ; // no-op S--; } signal (S) { S++; }

STUDENT NAME: STUDENT ID: Problem 1 Problem 2 Problem 3 Problem 4 Problem 5 Total

Page 1. Goals for Today. Atomic Read-Modify-Write instructions. Examples of Read-Modify-Write

Concurrency. On multiprocessors, several threads can execute simultaneously, one on each processor.

Comp 310 Computer Systems and Organization

Monitors; Software Transactional Memory

PROCESS SYNCHRONIZATION

7: Interprocess Communication

COMP 3361: Operating Systems 1 Final Exam Winter 2009

1 Process Coordination

Final Exam Preparation Questions

CSE 451: Operating Systems Winter Lecture 7 Synchronization. Steve Gribble. Synchronization. Threads cooperate in multithreaded programs

Lecture. DM510 - Operating Systems, Weekly Notes, Week 11/12, 2018

Background. The Critical-Section Problem Synchronisation Hardware Inefficient Spinning Semaphores Semaphore Examples Scheduling.

Synchronization. Disclaimer: some slides are adopted from the book authors slides 1

Concurrency. On multiprocessors, several threads can execute simultaneously, one on each processor.

Multiprocessor System. Multiprocessor Systems. Bus Based UMA. Types of Multiprocessors (MPs) Cache Consistency. Bus Based UMA. Chapter 8, 8.

Synchronization for Concurrent Tasks

CSC Operating Systems Spring Lecture - XII Midterm Review. Tevfik Ko!ar. Louisiana State University. March 4 th, 2008.

Dealing with Issues for Interprocess Communication

CPS 110 Midterm. Spring 2011

Multiprocessor Systems. COMP s1

Introduction to Operating Systems Prof. Chester Rebeiro Department of Computer Science and Engineering Indian Institute of Technology, Madras

Condition Variables. Dongkun Shin, SKKU

Announcements. Class feedback for mid-course evaluations Receive about survey to fill out until this Friday

CS 537: Introduction to Operating Systems Fall 2015: Midterm Exam #2 SOLUTIONS

Concept of a process

University of Waterloo Midterm Examination Model Solution CS350 Operating Systems

Synchronization. Heechul Yun. Disclaimer: some slides are adopted from the book authors and Dr. Kulkani

Operating Systems. Operating Systems Summer 2017 Sina Meraji U of T

CSE 153 Design of Operating Systems

Semaphores and Monitors: High-level Synchronization Constructs

HY345 - Operating Systems

CS-537: Midterm Exam (Spring 2009) The Future of Processors, Operating Systems, and You

Process Synchronization

Sections 01 (11:30), 02 (16:00), 03 (8:30) Ashraf Aboulnaga & Borzoo Bonakdarpour

Lecture Topics. Announcements. Today: Concurrency (Stallings, chapter , 5.7) Next: Exam #1. Self-Study Exercise #5. Project #3 (due 9/28)

Transcription:

Final review q From threads to file systems

Disclaimer Not guaranteed to be everything you need to know, just an overview of second half of the course 2

What s covered by the exam? Lectures from Threads to File systems Readings Slides Extra reading for extra credit 1. H. Levy et al., Virtual Memory Management in the VAX/VMS Operating System, IEEE Computer, Mar. 1982. 2. T. Anderson et al., Scheduler activations: effective kernel support for the user-level management of parallelism, ACM TOCS, 10(1):53-79, Feb. 1992. 3. B. Lampson et al., Experiences with Processes and Monitors in Mesa, CACM, Feb. 1980. 4. M, Rosenblum et al., Design and implementation of the logstructured file system, SOSP, 1991. 3

Major topics User and kernel-level threads Critical sections, locks and synchronization variables Race conditions, synchronization problems deadlocks I/O File systems 4

Threads Threads motivation and concept Threads and processes User, kernel-level and hybrid threads Complications with threads Q: In class we listed the register set as a per-thread rather than per-process item. Why? After all, the machine has only one set of registers. Q: Can the priority inversion problem discussed in class happen with user-level threads? Why or why not? 5

Synchronization Race conditions and critical sections Requirements for a solution Locks and their implementation Disabling interrupts and TSL Busy waiting, priority inversion and sleeping Basic lock-based data structures Q: Can two threads in the same process synchronize using a kernel semaphore if the threads are implemented by the kernel? What if they are implemented in user space? Assume that no threads in any other processes have access to the semaphores. Q: Why does disabling interrupts work for implementing locks in a single processor, and why is it not used outside the kernel? 6

Synchronization II Condition variables Semaphores, issues with semaphores and monitors Bounded buffer problem Reader-writers problem Q: Synchronization within monitors uses condition variables and two special operations wait and signal. A more general form of synchronization would be to have a single primitive, waituntil, that had an arbitrary Boolean predicate as parameter. Thus, one could say, for instance waituntil ((x < 0) ((y + z) < n)) The signal primitive would no longer be needed, of course. This scheme is clearly more flexible than then one discussed, but it is not used. Why not? Hint: Think about the implementation. 7

Monitor for an alarm clock Q: This is a snippet of the producer/consumer void *producer(void *arg) { int i; for (i = 0; i < loops; i++) { sem_wait(&empty); sem_wait(&mutex); put(i); sem_post(&mutex); sem_post(&full); } } void *consumer(void *arg) { int i; for (i = 0; i < loops; i++) { sem_wait(&full); sem_wait(&mutex); int tmp = get(); sem_post(&mutex); sem_post(&empty); } } Looking at the producer, why do you need the "mutex" semaphore if you have "empty"? Same in the consumer with "full"... Wouldn t those be enough? 8

Deadlocks Deadlock definition Condition for deadlocks Deadlock detection and recovery Dynamic deadlock avoidance Deadlock prevention Q: A system has two processes and three identical resources. Each process needs a maximum of two resources. Is deadlock possible? Explain your answer. 9

I/O Principles of I/O hardware Ways I/O can be done Disks Disk scheduling RAID Q: A computer manufacturer decides to redesign the partition table of a Pentium hard disk to provide more than four partitions. What are some consequences of this change? 10

File systems interface File system abstractions files and directories Implementing files Implementing directories Protection Q: A key issue when designing a FS is deciding how to keep track of which disk block goes with which file. Of the approaches discussed, which one would you choose to maximize efficiency in terms of speed of access, use of storage space, and ease of updating (adding, deleting, modifying) when the data is: a. Updated very infrequently and accessed frequently in random order. b. Updated frequently and accessed in its entirety relatively frequently. c. Updated frequently and accessed frequently in random order. 11

File systems implementation Early FS examples FFS Fsck and journaling Log file system Q: How many disk operations are needed to fetch the i-node for the file /home/fabianb/courses/eecs343/final10.tex? Assume that the i-node for the root directory is in memory, but nothing else along the path is in memory. Also, assume that all directories fit in one disk block. Q: How would you keep track of free blocks in a FAT file system? How would you find a free block then? 12

Notes on the final from those grading Write only your netid and on the first page It will help us grade anonymously Handwriting must be legible We weren't able to grade some midterm s responses Make it *very clear* what your final answer is Multiple answers will make you loose credit 13