HW/Study Guide.

Slides:



Advertisements
Similar presentations
HW/Study Guide. Synchronization Make sure you understand the HW problems!
Advertisements

Ch. 7 Process Synchronization (1/2) I Background F Producer - Consumer process :  Compiler, Assembler, Loader, · · · · · · F Bounded buffer.
Chapter 6 Process Synchronization Bernard Chen Spring 2007.
Process Synchronization. Module 6: Process Synchronization Background The Critical-Section Problem Peterson’s Solution Synchronization Hardware Semaphores.
Cooperating Processes Independent process cannot affect or be affected by the execution of another process. Cooperating process can affect or be affected.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 7: Process Synchronization Background The Critical-Section Problem Synchronization.
Chapter 6: Process Synchronization. Outline Background Critical-Section Problem Peterson’s Solution Synchronization Hardware Semaphores Classic Problems.
Chapter 6: Process Synchronization. 6.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Feb 8, 2005 Objectives Understand.
Chapter 6: Synchronization. 6.2 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Module 6: Synchronization 6.1 Background 6.2 The Critical-Section.
A. Frank - P. Weisberg Operating Systems Introduction to Cooperating Processes.
02/14/2007CSCI 315 Operating Systems Design1 Process Synchronization Notice: The slides for this lecture have been largely based on those accompanying.
Adopted from and based on Textbook: Operating System Concepts – 8th Edition, by Silberschatz, Galvin and Gagne Updated and Modified by Dr. Abdullah Basuhail,
Paging Examples Assume a page size of 1K and a 15-bit logical address space. How many pages are in the system?
Silberschatz, Galvin and Gagne  Operating System Concepts Cooperating Processes Independent process cannot affect or be affected by the execution.
COS 598: Advanced Operating System. Operating System Review What are the two purposes of an OS? What are the two modes of execution? Why do we have two.
Concurrency, Mutual Exclusion and Synchronization.
1 CMSC421: Principles of Operating Systems Nilanjan Banerjee Principles of Operating Systems Acknowledgments: Some of the slides are adapted from Prof.
Processes: program + execution state
1 11/1/2015 Chapter 4: Processes l Process Concept l Process Scheduling l Operations on Processes l Cooperating Processes l Interprocess Communication.
3.1 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 9 th Edition Interprocess Communication Processes within a system may be.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 7: Process Synchronization Background The Critical-Section Problem Synchronization.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts Essentials – 9 th Edition Chapter 5: Process Synchronization.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 10 Processes II Read.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 4: Processes Process Concept Process Scheduling Operations on Processes Cooperating.
Background Concurrent access to shared data may result in data inconsistency Maintaining data consistency requires mechanisms to ensure the orderly execution.
Operating Systems Lecture Notes Synchronization Matthew Dailey Some material © Silberschatz, Galvin, and Gagne, 2002.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 6: Process Synchronization.
Operating Systems CMPSC 473 Signals, Introduction to mutual exclusion September 28, Lecture 9 Instructor: Bhuvan Urgaonkar.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Processes.
Process Synchronization. Objectives To introduce the critical-section problem, whose solutions can be used to ensure the consistency of shared data To.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 6: Process Synchronization.
3.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Process Termination Process executes last statement and asks the operating.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 5: Process Synchronization.
CSC 360, Instructor: Kui Wu IPC. CSC 360, Instructor: Kui Wu Agenda 1.The need to communicate 2.Shared memory 3.Message passing.
MIDTERM REVIEW CSCC69 Winter 2016 Kanwar Gill. What is an OS? What are processes and threads? Process states? Diagram showing the state changes What data.
1 Module 3: Processes Reading: Chapter Next Module: –Inter-process Communication –Process Scheduling –Reading: Chapter 4.5, 6.1 – 6.3.
Memory: Page Table Structure CSSE 332 Operating Systems Rose-Hulman Institute of Technology.
Memory: Page Table Structure
Translation Lookaside Buffer
Lecture 11 Virtual Memory
Names and Attributes Names are a key programming language feature
Topic 3 (Textbook - Chapter 3) Processes
Background on the need for Synchronization
Lecture Topics: 11/19 Paging Page tables Memory protection, validation
Virtual Memory User memory model so far:
Processes Chapter 3 These slides include text, figures, and information from Operating Systems Concepts, by Silberschatz, Galvin, and Gagne. They also.
CS703 - Advanced Operating Systems
COMBINED PAGING AND SEGMENTATION
Chapter 3: Process Concept
Chapter 5: Process Synchronization
Paging Examples Assume a page size of 1K and a 15-bit logical address space. How many pages are in the system?
Happy Children’s Day.
Chapter 4: Processes Process Concept Process Scheduling
Paging Lecture November 2018.
FIGURE 12-1 Memory Hierarchy
The Operating System Machine Level
Topic 6 (Textbook - Chapter 5) Process Synchronization
Process Synchronization
Lecture 19 Syed Mansoor Sarwar
Introduction to Cooperating Processes
Module 7a: Classic Synchronization
Translation Lookaside Buffer
Grades.
Chapter 6: Process Synchronization
CSE 451: Operating Systems Autumn 2003 Lecture 10 Paging & TLBs
Lecture 18 Syed Mansoor Sarwar
CSE451 Virtual Memory Paging Autumn 2002
CSE 451: Operating Systems Autumn 2003 Lecture 10 Paging & TLBs
Chapter 6: Synchronization Tools
CS703 - Advanced Operating Systems
Presentation transcript:

HW/Study Guide

Synchronization Make sure you understand the HW problems!

global shared int counter = 0, BUFFER_SIZE = 10 ; Producer: while (1) { while (counter == BUFFER_SIZE); // do nothing buffer[in] = nextProduced; in = (in + 1) % BUFFER_SIZE; counter++; }

Consumer: while (1) { while (counter == 0); // do nothing nextConsumed = buffer[out]; out = (out + 1) % BUFFER_SIZE; counter--; // consume the item }

Fix this race condition using the TestAndSet hardware instruction. Identify the race condition in this version of the consumer/producer problem. Fix this race condition using the TestAndSet hardware instruction. Now assume there is still one producer but there are now two consumers. Does this introduce any additional race conditions (the correct answer is yes!)?

If so, where does it occur? Now fix this additional race condition using a semaphore.

Assume I have just learned about using semaphores to synchronize the order in which certain statements are executed. I think this is really cool, and want to give it a try. So I want to use semaphores to enforce the following execution order: Statement S1 of process P1 executes before statement S2 of process P2. Statement S2 of process P2 executes before statement S3 of Process P3.

Statement S3 of process P3 executes before Statement S1 of process P1. Use semaphores to enforce this ordering, or, show how this may not be such a great idea (i.e., what is the problem here?).

Now assume we have four processes and want Statement S1 in P1 to execute before statement S2 in P2 before S3 in P3. Also, we want Statement S4 in P4 to execute after S2 in P2. Use semaphores to enforce this ordering. You must explicitly initialize any semaphores you use.

Assume there is one producer process and one consumer process, and that they share a buffer with 10 slots. Implement the producer/consumer problem using semaphores. You must explicitly initialize the semaphores that you use.

Paging Assume a 16-bit virtual address space with pages that are 2048 bytes. How many pages are in the logical address space? Consider the following page table for some process in this system. 2 1 3 21

Paging Consider the following page table for some process in this system, and assume the logical address is 2052. To what physical address will this logical address be mapped? Show the steps you took to determine this address. 2 1 3 21

What is the Translation Lookaside buffer? What purpose does it serve? Consider a 64-bit address space with 4K pages. How many pages are there in this virtual address space? Is this a big number? You will most likely be asked to work through a two-level page table example.