Outline. TDDC47 Lesson 1: Pintos labs Assignments 0, 1, 2. Administration. A new kind of complexity. The Pintos boot process
|
|
- Elmer Gardner
- 6 years ago
- Views:
Transcription
1 TDDC47 Lesson 1: Pintos labs Assignments 0, 1, 2 Jordi Cucurull, Mikael Asplund 2010 Administration Introduction to Pintos Scheduler Interrupts Synchronisation General description of labs Lab 1 Lab 2 Outline Some slides by Mattias Eriksson and Viacheslav Izosimov Administration Sign up in Webreg (link on course page) Two groups (A, B) Labs done in pairs Examination Before 9 th December!!! Report with the code Individual test demonstration The solution you present must be yours! Plagiarism is considered a serious offence. A new kind of complexity Relatively large piece of software. New kind of complexity. Manage your changes (version control). Read a lot! You will spend more time trying to understand than writing code manual source < 1000 LOC Your programs so far? 5-10 KLOC Pintos. >100 KLOC Most real systems. What is Pintos? Pintos is an educational OS Developed at Stanford Works on x86 hardware Pintos is clean and well documented C Your task: add functionality to Pintos The name Pintos is a play on words (mexican food) Pinto beans The Pintos boot process You boot pintos like this: pintos --qemu -- run alarm-single Perl script that runs pintos in a simulator Arguments to the run script loader.s: Assembler code that loads kernel Arguments passed straight to the kernel threads/init.c, main(): initializes Pintos subsystems run_actions(): runs tasks given on kernel command line 1
2 Mechanism that manages the threads of the system. Possible thread states: Ready: Prepared and waiting to run Dying Running: Running in the CPU Blocked: Sleeping and waiting to wake up Create Dying: Execution finished Threads organised in queues The scheduler Ready Schedule Wake up Finish Interrupts CPU normally operates in fetch-execute cycle Fetch the next instruction Execute this instruction Sometimes things happen where we must temporarily stop this cycle e.g. user input (mouse, keyboard), or a clock tick Blocked Sleep Running Interrupts Interrupt: signal that makes the operating system to stop the fetch-execute cycle: Save state (PC,...) Jump to interrupt handler (kernel) Restore state Jump back and continue fetch-execute cycle Internal interrupts caused by software Interrupts in Pintos invalid memory access (seg. fault) division by 0 system calls External interrupts comes from outside the CPU keyboard serial port system timer, every clock tick Ext. interrupts can be delayed intr_disable(); ->synchronization! Example with Threads Thread 1 Interrupt context in Pintos Handler of external interrupt not allowed to block: Sleep, sema_down, or lock_acquire Timer interrupt Thread 2 One time unit is a tick Every 4 th tick threads are forced to yield Default in Pintos: 100 ticks per second Consider the following scenario: Thread x is running in the kernel Thread x enters a critical region: lock_acquire(l) External interrupt occurs; it will be handled in the kernel running as x Interrupt handler does lock_acquire(l) DEADLOCK: L will never be released. 2
3 The critical section problem Critical Section: Segment of code present in several processes the execution of which is mutually exclusive. Properties: Mutual exclusion: If a process is executing in its critical section, no other processes can be executing in their critical sections. Progress: Only processes waiting to enter the critical section and the ones leaving it can decide on the next process that will enter it. And this cannot be postponed indefinitely. Bounded waiting: There is a bound in the number of times a process can enter the critical section after another process has requested to enter in it. Synchronisation Pintos has 3 basic synchronization primitives Sempahores Locks Conditions Semaphores Semaphore s: shared integer variable two atomic operations to modify s: sema_down(s) and sema_up(s) Sometimes called P() and V() Initialize s to 5 function use_car() { sema_down(s); enter_car(); leave_car(); sema_up(s); Example: At most five passengers in the car Semaphores in Pintos void sema_down (struct semaphore *sema) { enum intr_level old_level; Disabling interrupts -> no thread switching old_level = intr_disable (); while (sema->value == 0) { list_push_back ( cur_thread ); thread_block (); sema->value--; intr_set_level (old_level); value 0 is a red light Semaphores in Pintos void sema_up (struct semaphore *sema) { enum intr_level old_level; old_level = intr_disable (); if (!list_empty (&sema->waiters)){ thread_unblock (list_pop_front(...) ); sema->value++; intr_set_level (old_level); value >0 is a green light Locks Similar to a binary semaphore Either locked (0) or unlocked (1) Only the locker can unlock it The locker has the key Advantage: Good to use for mutual exclusion Recall: semaphores can be upped by anyone. Essential for security, for example, access to the shared data, arrays, lists, and etc. 3
4 Conditions Queuing mechanism on top of Locks Prevents deadlock situations by temporarily allowing someone else in the critical region: lock_acquire(l);... //Must wait for something to happen cond_wait(c,l); //Waiting inside crit. sec.... lock_release(l); Example: Fixed size synchronized list. writing when internal buffer is full reading when internal buffer is empty General Description of Labs Lab 0: Introduction and installation Introductory lab Environment Debugging Lab 1: Threads, interrupts and synchronization First real lab Threads Interrupts Timer General Description of Labs Lab 2: Scheduling The pintos scheduler Priority scheduling Interaction with locks semaphores condition variables Lab 00 Debug a small program debugthis.c with ddd after compiling it with gcc -g. Create a linked list (example solution is available). If you are having much problems with this lab you should focus on learning C before you proceed. I suggest the book known as K&R (Kernighan & Ritchie, The C Programming language). First contact with Threads Interrupts Scheduling Lab 1 Your task: implement the function timer_sleep(int64_t ticks) Current solution (busy waiting) is not acceptable: int64_t start = timer_ticks (); while (timer_elapsed (start) < ticks) { thread_yield (); //Wasting CPU-cycles! Pintos kernel Lab 1: Pintos kernel overview Synchronization primitives File system Timer User programs System call Interrupt handlers syscall, timer, kbd, etc Drivers Hardware Page table Scheduler Threads LAB1 4
5 Lab1: Thread states ing puts a thread back in the ready queue Ready threads are scheduled by the kernel Sleeping threads should be blocked Blocked Wake up Ready Sleep int64_t start = timer_ticks (); while (timer_elapsed (start) < ticks) { thread_yield (); //Wasting CPU-cycles! Schedule Running Example with Threads Timer interrupt Thread 2 Thread 1 One time unit is a tick Every 4 th tick threads are forced to yield Default in Pintos: 100 ticks per second Lab1: hint (another use of semaphores) A good way to wake someone up: // A global pointer struct semaphore *sleeper; // SLEEPER thread: struct semaphore s; sema_init(&s,0); sleeper = &s; sema_down(&s); //zzz.. // WAKER sema_up(sleeper); Hint: extend so that sleeper is list of semaphores and wakeup times! Pintos list Pintos has a clever doubly linked list (see lib/kernel/list.h) Example: you need a list of struct foo items Add a struct list_elem to foo struct foo{... //data struct list_elem elem; ; struct list foo_list; init_list(&foo_list); for (e = list_begin (&foo_list); e!= list_end (&foo_list); e = list_next (e)) { struct foo *cur_foo = list_entry(e, struct foo, elem);... //use cur_foo... foo are not put into the list, the list is attached to foo Run the tests alarm-single alarm-multiple alarm-simultaneous alarm-zero alarm-negative Lab1 --- Testing gmake SIMULATOR=--qemu check Must pass all these tests! Run individual tests like this: make tests/threads/alarm-simultaneous.result Important!! Tests will also pass before you do any modifications Printing debug messages can make tests to fail Pintos kernel Lab 2: Pintos kernel overview Synchronization primitives File system Timer User programs System call Interrupt handlers syscall, timer, kbd, etc Drivers Hardware Page table Scheduler Threads LAB2 5
6 Lab 2: Priority Scheduling Modification of the Pintos scheduler to introduce priority scheduling Execute threads with highest priority. Awake blocked threads in order of priority. Your task: Modify code related to: Scheduler Semaphores Condition variables Lab2: Thread states and queues ing puts the running thread back to the ready queue Ready threads are scheduled by the kernel scheduler Sleeping threads are blocked and and wake up by the synchronisation primitives Wake up Ready Create Schedule Blocked Sleep Running Lab2: Requirements The running thread must yield CPU when: A new thread with higher priority is introduced in the ready list. The running thread lowers its priority below other waiting threads. If several threads have the same priority a round robin order must be followed. Threads block by a synchronisation primitive must be awaken in order of priority. Lab2: Implementation thread.c Two methods are already implemented: void thread_set_priority(int priority) : Sets the priority of the thread int thread_get_priority() : Gets the priority of the thread The priority is stored as integer in variable priority PRI_DEFAULT(31): Default priority PRI_MIN(0) PRI_MAX(63): Range of available priorities The scheduler is implemented by method schedule() It selects new thread to run and does context switching. You have to understand and modify it. The method to make a thread to yield the CPU is void thread_yield() Lab2: Implementation synch.c Synchronisation primitives that you will modify void sema_up (struct semaphore *sema) void sema_down (struct semaphore *sema) void cond_wait (struct condition *cond, struct lock *lock) void cond_signal (struct condition *cond, struct lock *lock UNUSED) Run the tests alarm-priority priority-change priority-fifo priority-preempt priority-sema priority-condvar Lab2: Testing gmake SIMULATOR=--qemu check Must pass all these tests! Run individual tests like this: make tests/threads/priority-change.result Important!!! Printing debug messages can make tests to fail 6
7 Subversion svn up #get latest version from repository svn commit #record changes in repository svn st #show which files are modified and new svn diff #show difference between working copy and most recently checked in revision svn -r 17 diff #same, but compared to revision 17 svn -r 17 -x -wp diff #ignore changes in whitespace and include context information svn log #show commit log svn -v log #also list which files are modified Debugging tips Read Appendix E in the documentation. ASSERT(mypointer!= NULL). Bytes in memory that have been freed are set to 0xcc If a pointer == 0xcccccccc something probably freed the memory. If you get a Kernel Panic use the backtrace tool... The backtrace tool 7
TDDB Lesson 2 Introduction to Pintos Assignments (1) and 2
TDDB68 2015 Lesson 2 Introduction to Pintos Assignments (1) and 2 Erik Hansson erik.hansson@liu.se Most slides by Mattias Eriksson 2009-2010 and Viacheslav Izosimov 2007-2008. Outline Administration Introduction
More informationTDDB68 Lesson 1 Introduction to Pintos Assignments 00, 0, 1, 2
TDDB68 Lesson 1 Introduction to Pintos Assignments 00, 0, 1, 2 Mattias Eriksson 2010 mater@ida.liu.se Some slides by Viacheslav Izosimov 2007-2008 Outline Administration Introduction to Pintos Important
More informationFriday, September 23, Pintos
Pintos Kernel structure UNIX-like Monolithic Unithreading, multiprogramming No virtual memory Bare-bones file system Preemptible Threads New thread == new context Sort of a miniprogram Runs until return
More informationTDDB Lesson 3 Pintos Assignments (2), 3 & 4. Erik Hansson
TDDB68 2015 Lesson 3 Pintos Assignments (2), 3 & 4 Erik Hansson erik.hansson@liu.se Most slides by Mattias Eriksson 2009-2010 and Viacheslav Izosimov 2007-2008 Remember Pass assignments on time to get
More information김주남, 우병일, 최종은 *, Nick 박주호, 박진영 *, 안세건, 이대현
Project Teams Team Name WINOS Prime Megatron Members 고경민 *, 홍종목, 유상훈 이경준, 김종석 *, 이현수 이태훈 *, 선우석, 오동근 닥코딩박재영*, 이경욱, 박병규 5분대기조박지용, 정종균, 김대호 * 김주남, 우병일, 최종은 *, Nick 박주호, 박진영 *, 안세건, 이대현 1 Project 1: Threads
More informationTDDB Lesson 2 Pintos Assignments (2), 3 & 4. Erik Hansson
TDDB68 2013 Lesson 2 Pintos Assignments (2), 3 & 4 Erik Hansson erik.hansson@liu.se Most slides by Mattias Eriksson 2009-2010 and Viacheslav Izosimov 2007-2008 Instead of Motivation Some of you should
More informationProject 1: Threads. Jin-Soo Kim ( Computer Systems Laboratory Sungkyunkwan University
Project 1: Threads Jin-Soo Kim ( jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu # of addr spaces: Pintos Kernel (1) The current Pintos kernel There is only
More informationSection 7: Scheduling and Fairness
March 1-2, 2018 Contents 1 Warmup 2 2 Vocabulary 2 3 Problems 3 3.1 Scheduling............................................. 3 3.2 Simple Priority Scheduler.................................... 4 3.2.1 Fairness..........................................
More informationCS140 Discussion Section 1 April 2014
CS140 Discussion Section 1 April 2014 Outline For Today Project Advice / Info Jumpstarting Project 1 Using Pintos Alarm Clock Priority Scheduling & Priority Donation Advanced Scheduler Semaphores 50% of
More informationCS Computer Systems. Project 1: Threads in Pintos
CS 5600 Computer Systems Project 1: Threads in Pintos Getting Started With Pintos What does Pintos Include? Threads in Pintos Project 1 2 What is Pintos? Pintos is a teaching operating system from Stanford
More informationPintos: Threads Project. Slides by: Vijay Kumar Updated by Godmar Back Presented by: Min Li
Pintos: Threads Project Slides by: Vijay Kumar Updated by Godmar Back Presented by: Min Li Introduction to Pintos Simple OS for the 80x86 architecture Capable of running on real hardware We use bochs,
More informationcs 140 project 1: threads 9 January 2015
cs 140 project 1: threads 9 January 2015 git The basics: git clone git add git commit git branch git merge git stash git pull git push git rebase git Some guidelines & ideas: Write helpful commit and stash
More informationCS 318 Principles of Operating Systems
CS 318 Principles of Operating Systems Fall 2017 Lecture 7: Semaphores and Monitors Ryan Huang Higher-Level Synchronization We looked at using locks to provide mutual exclusion Locks work, but they have
More informationTDDB68. Lesson 1. Simon Ståhlberg
TDDB68 Lesson 1 Simon Ståhlberg Contents General information about the labs Overview of the labs Memory layout of C programs ("Lab 00") General information about Pintos System calls Lab 1 Debugging Administration
More informationCS 318 Principles of Operating Systems
CS 318 Principles of Operating Systems Fall 2018 Lecture 7: Semaphores and Monitors Ryan Huang Slides adapted from Geoff Voelker s lectures Administrivia HW2 is out Do the exercise to check your understanding
More informationCS 140. Lab 1 - Threads
CS 140 Lab 1 - Threads setup lab 1 git general setup lab 1 git general Getting started with pintos http://www.scs.stanford.edu/14wics140/pintos/pintos_1.html Get the Source set your path set path = ( /usr/class/cs140/`uname
More informationLast Class: CPU Scheduling! Adjusting Priorities in MLFQ!
Last Class: CPU Scheduling! Scheduling Algorithms: FCFS Round Robin SJF Multilevel Feedback Queues Lottery Scheduling Review questions: How does each work? Advantages? Disadvantages? Lecture 7, page 1
More informationProgOS UE. Daniel Prokesch, Denise Ratasich. basierend auf Slides von Benedikt Huber, Roland Kammerer, Bernhard Frömel
1/50 Daniel Prokesch, Denise Ratasich basierend auf Slides von Benedikt Huber, Roland Kammerer, Bernhard Frömel Institut für Technische Informatik Technische Universität Wien - 182.710 Programmierung von
More informationSystèmes d Exploitation Avancés
Systèmes d Exploitation Avancés Instructor: Pablo Oliveira ISTY Instructor: Pablo Oliveira (ISTY) Systèmes d Exploitation Avancés 1 / 32 Review : Thread package API tid thread create (void (*fn) (void
More informationToday: Synchronization. Recap: Synchronization
Today: Synchronization Synchronization Mutual exclusion Critical sections Example: Too Much Milk Locks Synchronization primitives are required to ensure that only one thread executes in a critical section
More informationOperating Systems (1DT020 & 1TT802)
Uppsala University Department of Information Technology Name: Perso. no: Operating Systems (1DT020 & 1TT802) 2009-05-27 This is a closed book exam. Calculators are not allowed. Answers should be written
More informationCS 318 Principles of Operating Systems
CS 318 Principles of Operating Systems Fall 2017 Midterm Review Ryan Huang 10/12/17 CS 318 Midterm Review 2 Midterm October 17 th Tuesday 9:00-10:20 am at classroom Covers material before virtual memory
More informationOPERATING SYSTEMS ASSIGNMENT 2 SIGNALS, USER LEVEL THREADS AND SYNCHRONIZATION
OPERATING SYSTEMS ASSIGNMENT 2 SIGNALS, USER LEVEL THREADS AND SYNCHRONIZATION Responsible TAs: Vadim Levit & Benny Lutati Introduction In this assignment we will extend xv6 to support a simple signal
More informationLearning Outcomes. Concurrency and Synchronisation. Textbook. Concurrency Example. Inter- Thread and Process Communication. Sections & 2.
Learning Outcomes Concurrency and Synchronisation Understand concurrency is an issue in operating systems and multithreaded applications Know the concept of a critical region. Understand how mutual exclusion
More informationOperating Systems, Assignment 2 Threads and Synchronization
Operating Systems, Assignment 2 Threads and Synchronization Responsible TA's: Zohar and Matan Assignment overview The assignment consists of the following parts: 1) Kernel-level threads package 2) Synchronization
More informationCSE 153 Design of Operating Systems
CSE 153 Design of Operating Systems Winter 2018 Midterm Review Midterm in class on Monday Covers material through scheduling and deadlock Based upon lecture material and modules of the book indicated on
More informationChapter 6: Process Synchronization
Chapter 6: Process Synchronization Objectives Introduce Concept of Critical-Section Problem Hardware and Software Solutions of Critical-Section Problem Concept of Atomic Transaction Operating Systems CS
More informationConcurrency and Synchronisation
Concurrency and Synchronisation 1 Learning Outcomes Understand concurrency is an issue in operating systems and multithreaded applications Know the concept of a critical region. Understand how mutual exclusion
More informationTDDB68 Lesson 2 Pintos Assignments 3 & 4. Mattias Eriksson 2010 (or
TDDB68 Lesson 2 Pintos Assignments 3 & 4 Mattias Eriksson 2010 mater@ida.liu.se (or mattias.eriksson@liu.se) some slides by Viacheslav Izosimov 2007-2008 Instead of Motivation Plan for something like this:
More informationReview: Thread package API
Review: Thread package API tid thread_create (void (*fn) (void *), void *arg); - Create a new thread that calls fn with arg void thread_exit (); void thread_join (tid thread); The execution of multiple
More informationSynchronization 1. Synchronization
Synchronization 1 Synchronization key concepts critical sections, mutual exclusion, test-and-set, spinlocks, blocking and blocking locks, semaphores, condition variables, deadlocks reading Three Easy Pieces:
More informationConcurrency and Synchronisation
Concurrency and Synchronisation 1 Sections 2.3 & 2.4 Textbook 2 Making Single-Threaded Code Multithreaded Conflicts between threads over the use of a global variable 3 Inter- Thread and Process Communication
More informationCS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring Lecture 8: Semaphores, Monitors, & Condition Variables
CS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring 2004 Lecture 8: Semaphores, Monitors, & Condition Variables 8.0 Main Points: Definition of semaphores Example of use
More informationCS 162 Project 1: Threads
CS 162 Design Document Due: Friday, February 19, 2016 Code Due: Friday, March 4, 2016 Final Report Due: Monday, March 7, 2016 Contents 1 Your task 3 1.1 Task 1: Efficient Alarm Clock..................................
More informationMidterm Exam #1 February 28, 2018 CS162 Operating Systems
University of California, Berkeley College of Engineering Computer Science Division EECS Spring 2018 Anthony D. Joseph and Jonathan Ragan-Kelley Midterm Exam #1 February 28, 2018 CS162 Operating Systems
More informationC09: Process Synchronization
CISC 7310X C09: Process Synchronization Hui Chen Department of Computer & Information Science CUNY Brooklyn College 3/29/2018 CUNY Brooklyn College 1 Outline Race condition and critical regions The bounded
More informationProject-1 Discussion
CSE 421/521 - Operating Systems Fall 2014 Lecture - VI Project-1 Discussion Tevfik Koşar University at Buffalo September 11 th, 2014 1 Pintos Projects 1. Threads
More informationArdOS The Arduino Operating System Reference Guide Contents
ArdOS The Arduino Operating System Reference Guide Contents 1. Introduction... 2 2. Error Handling... 2 3. Initialization and Startup... 2 3.1 Initializing and Starting ArdOS... 2 4. Task Creation... 3
More informationCondition Variables CS 241. Prof. Brighten Godfrey. March 16, University of Illinois
Condition Variables CS 241 Prof. Brighten Godfrey March 16, 2012 University of Illinois 1 Synchronization primitives Mutex locks Used for exclusive access to a shared resource (critical section) Operations:
More informationInterrupts and Time. Real-Time Systems, Lecture 5. Martina Maggio 28 January Lund University, Department of Automatic Control
Interrupts and Time Real-Time Systems, Lecture 5 Martina Maggio 28 January 2016 Lund University, Department of Automatic Control Content [Real-Time Control System: Chapter 5] 1. Interrupts 2. Clock Interrupts
More informationProcess Synchronization: Semaphores. CSSE 332 Operating Systems Rose-Hulman Institute of Technology
Process Synchronization: Semaphores CSSE 332 Operating Systems Rose-Hulman Institute of Technology Critical-section problem solution 1. Mutual Exclusion - If process Pi is executing in its critical section,
More informationCS 140 Midterm Examination Winter Quarter, 2012
CS 140 Midterm Examination Winter Quarter, 2012 You have 1.5 hours (90 minutes) for this examination; the number of points for each question indicates roughly how many minutes you should spend on that
More informationCSCI 350: Pintos Guide Written by: Stephen Tsung-Han Sher November 5, 2016
CSCI 350: Pintos Guide Written by: Stephen Tsung-Han Sher November 5, 2016 Introduction This guide serves to help you along the projects of Pintos for CSCI 350. The aim of this document is to minimize
More informationProcess & Thread Management II. Queues. Sleep() and Sleep Queues CIS 657
Process & Thread Management II CIS 657 Queues Run queues: hold threads ready to execute Not a single ready queue; 64 queues All threads in same queue are treated as same priority Sleep queues: hold threads
More informationProcess & Thread Management II CIS 657
Process & Thread Management II CIS 657 Queues Run queues: hold threads ready to execute Not a single ready queue; 64 queues All threads in same queue are treated as same priority Sleep queues: hold threads
More informationInterrupts and Time. Interrupts. Content. Real-Time Systems, Lecture 5. External Communication. Interrupts. Interrupts
Content Interrupts and Time Real-Time Systems, Lecture 5 [Real-Time Control System: Chapter 5] 1. Interrupts 2. Clock Interrupts Martina Maggio 25 January 2017 Lund University, Department of Automatic
More informationLecture #7: Implementing Mutual Exclusion
Lecture #7: Implementing Mutual Exclusion Review -- 1 min Solution #3 to too much milk works, but it is really unsatisfactory: 1) Really complicated even for this simple example, hard to convince yourself
More informationReview: Processes. A process is an instance of a running program. POSIX Thread APIs:
Review: Processes A process is an instance of a running program - A thread is an execution context - Process can have one or more threads - Threads share address space (code, data, heap), open files -
More informationIntroduction to Operating Systems
Introduction to Operating Systems Lecture 4: Process Synchronization MING GAO SE@ecnu (for course related communications) mgao@sei.ecnu.edu.cn Mar. 18, 2015 Outline 1 The synchronization problem 2 A roadmap
More informationSYNCHRONIZATION 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
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 2. 3. 8 A N D 2. 3. 1 0 S P R I N G 2018 INTER-PROCESS COMMUNICATION 1. How a process pass information to another process
More informationMidterm Exam #2 April 20, 2016 CS162 Operating Systems
University of California, Berkeley College of Engineering Computer Science Division EECS Spring 2016 Anthony D. Joseph Midterm Exam #2 April 20, 2016 CS162 Operating Systems Your Name: SID AND 162 Login:
More informationCSCI 350 Pintos Intro. Mark Redekopp
1 CSCI 350 Pintos Intro Mark Redekopp 2 Resources Pintos Resources https://web.stanford.edu/class/cs140/projects/pintos/pintos.html#sec_top Skip Stanford related setup in section 1.1 and 1.1.1 http://bits.usc.edu/cs350/assignments/pintos_guide_2016_11_13.pdf
More informationProgram A. Review: Thread package API. Program B. Program C. Correct answers. Correct answers. Q: Can both critical sections run?
Review: Thread package API tid thread_create (void (*fn) (void *), void *arg); - Create a new thread that calls fn with arg void thread_exit (); void thread_join (tid thread); The execution of multiple
More informationEE458 - Embedded Systems Lecture 8 Semaphores
EE458 - Embedded Systems Lecture 8 Semaphores Outline Introduction to Semaphores Binary and Counting Semaphores Mutexes Typical Applications RTEMS Semaphores References RTC: Chapter 6 CUG: Chapter 9 1
More informationTDDB Lesson 3 Pintos Assignments (2), 3 & 4. Erik Hansson
TDDB68 2016 Lesson 3 Pintos Assignments (2), 3 & 4 Erik Hansson erik.hansson@liu.se Most slides by Mattias Eriksson 2009-2010 and Viacheslav Izosimov 2007-2008 Plan your time Plan your time with your
More informationAUTOBEST: A United AUTOSAR-OS And ARINC 653 Kernel. Alexander Züpke, Marc Bommert, Daniel Lohmann
AUTOBEST: A United AUTOSAR-OS And ARINC 653 Kernel Alexander Züpke, Marc Bommert, Daniel Lohmann alexander.zuepke@hs-rm.de, marc.bommert@hs-rm.de, lohmann@cs.fau.de Motivation Automotive and Avionic industry
More informationSection 7: Wait/Exit, Address Translation
William Liu October 15, 2014 Contents 1 Wait and Exit 2 1.1 Thinking about what you need to do.............................. 2 1.2 Code................................................ 2 2 Vocabulary 4
More informationThe Kernel Abstraction
The Kernel Abstraction Debugging as Engineering Much of your time in this course will be spent debugging In industry, 50% of software dev is debugging Even more for kernel development How do you reduce
More informationSynchronising Threads
Synchronising Threads David Chisnall March 1, 2011 First Rule for Maintainable Concurrent Code No data may be both mutable and aliased Harder Problems Data is shared and mutable Access to it must be protected
More informationReview: Program Execution. Memory program code program data program stack containing procedure activation records
Threads and Concurrency 1 Review: Program Execution Registers program counter, stack pointer,... Memory program code program data program stack containing procedure activation records CPU fetches and executes
More informationSynchronization 1. Synchronization
Synchronization 1 Synchronization key concepts critical sections, mutual exclusion, test-and-set, spinlocks, blocking and blocking locks, semaphores, condition variables, deadlocks reading Three Easy Pieces:
More informationCOMP 3430 Robert Guderian
Operating Systems COMP 3430 Robert Guderian file:///users/robg/dropbox/teaching/3430-2018/slides/06_concurrency/index.html?print-pdf#/ 1/76 1 Concurrency file:///users/robg/dropbox/teaching/3430-2018/slides/06_concurrency/index.html?print-pdf#/
More informationEECS 482 Introduction to Operating Systems
EECS 482 Introduction to Operating Systems Winter 2018 Harsha V. Madhyastha Monitors vs. Semaphores Monitors: Custom user-defined conditions Developer must control access to variables Semaphores: Access
More informationSemaphore. Originally called P() and V() wait (S) { while S <= 0 ; // no-op S--; } signal (S) { S++; }
Semaphore Semaphore S integer variable Two standard operations modify S: wait() and signal() Originally called P() and V() Can only be accessed via two indivisible (atomic) operations wait (S) { while
More informationReminder from last time
Concurrent systems Lecture 2: More mutual exclusion, semaphores, and producer-consumer relationships DrRobert N. M. Watson 1 Reminder from last time Definition of a concurrent system Origins of concurrency
More informationResource management. Real-Time Systems. Resource management. Resource management
Real-Time Systems Specification Implementation Verification Mutual exclusion is a general problem that exists at several levels in a real-time system. Shared resources internal to the the run-time system:
More informationRemaining Contemplation Questions
Process Synchronisation Remaining Contemplation Questions 1. The first known correct software solution to the critical-section problem for two processes was developed by Dekker. The two processes, P0 and
More informationCS-537: Midterm Exam (Fall 2013) Professor McFlub
CS-537: Midterm Exam (Fall 2013) Professor McFlub Please Read All Questions Carefully! There are fourteen (14) total numbered pages. Please put your NAME (mandatory) on THIS page, and this page only. Name:
More informationSemaphores. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University
Semaphores Jinkyu Jeong (jinkyu@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu EEE3052: Introduction to Operating Systems, Fall 2017, Jinkyu Jeong (jinkyu@skku.edu) Synchronization
More informationOperating Systems. Lecture 4 - Concurrency and Synchronization. Master of Computer Science PUF - Hồ Chí Minh 2016/2017
Operating Systems Lecture 4 - Concurrency and Synchronization Adrien Krähenbühl Master of Computer Science PUF - Hồ Chí Minh 2016/2017 Mutual exclusion Hardware solutions Semaphores IPC: Message passing
More informationCondition Variables & Semaphores
Condition Variables & Semaphores Nima Honarmand (Based on slides by Prof. Andrea Arpaci-Dusseau) Review: Concurrency Objectives Mutual Exclusion A & B don t run at the same time Solved using locks Ordering
More informationProcess Synchronisation (contd.) Operating Systems. Autumn CS4023
Operating Systems Autumn 2017-2018 Outline Process Synchronisation (contd.) 1 Process Synchronisation (contd.) Synchronization Hardware 6.4 (SGG) Many systems provide hardware support for critical section
More informationCS370 Operating Systems
CS370 Operating Systems Colorado State University Yashwant K Malaiya Fall 2017 Lecture 11 Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 FAQ Multilevel Feedback Queue: Q0, Q1,
More informationLecture 9: Midterm Review
Project 1 Due at Midnight Lecture 9: Midterm Review CSE 120: Principles of Operating Systems Alex C. Snoeren Midterm Everything we ve covered is fair game Readings, lectures, homework, and Nachos Yes,
More informationEECS 482 Introduction to Operating Systems
EECS 482 Introduction to Operating Systems Winter 2018 Baris Kasikci Slides by: Harsha V. Madhyastha Use of CVs in Project 1 Incorrect use of condition variables: while (cond) { } cv.signal() cv.wait()
More informationTwo hours. Question ONE is COMPULSORY UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE. Date: Friday 25th January 2013 Time: 14:00-16:00
Two hours Question ONE is COMPULSORY UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE Operating Systems Date: Friday 25th January 2013 Time: 14:00-16:00 Please answer Question ONE and any TWO other
More informationSemaphores in Nachos. Dr. Douglas Niehaus Michael Jantz Dr. Prasad Kulkarni. EECS 678 Nachos Semaphores Lab 1
Semaphores in Nachos Dr. Douglas Niehaus Michael Jantz Dr. Prasad Kulkarni EECS 678 Nachos Semaphores Lab 1 Introduction In this lab, we will implement a basic blocking semaphore and a queuing semaphore
More informationCS370 Operating Systems
CS370 Operating Systems Colorado State University Yashwant K Malaiya Spring 1018 L11 Synchronization Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 FAQ Multilevel feedback queue:
More informationProcess Synchronization
Process Synchronization Concurrent access to shared data in the data section of a multi-thread process, in the shared memory of multiple processes, or in a shared file Although every example in this chapter
More informationCSE 410 Final Exam 6/09/09. Suppose we have a memory and a direct-mapped cache with the following characteristics.
Question 1. (10 points) (Caches) Suppose we have a memory and a direct-mapped cache with the following characteristics. Memory is byte addressable Memory addresses are 16 bits (i.e., the total memory size
More informationProcess Synchronisation (contd.) Deadlock. Operating Systems. Spring CS5212
Operating Systems Spring 2009-2010 Outline Process Synchronisation (contd.) 1 Process Synchronisation (contd.) 2 Announcements Presentations: will be held on last teaching week during lectures make a 20-minute
More informationCHAPTER 6: PROCESS SYNCHRONIZATION
CHAPTER 6: PROCESS SYNCHRONIZATION The slides do not contain all the information and cannot be treated as a study material for Operating System. Please refer the text book for exams. TOPICS Background
More informationDeadlock and Monitors. CS439: Principles of Computer Systems September 24, 2018
Deadlock and Monitors CS439: Principles of Computer Systems September 24, 2018 Bringing It All Together Processes Abstraction for protection Define address space Threads Share (and communicate) through
More informationPROCESS SYNCHRONIZATION
PROCESS SYNCHRONIZATION Process Synchronization Background The Critical-Section Problem Peterson s Solution Synchronization Hardware Semaphores Classic Problems of Synchronization Monitors Synchronization
More informationMULTITHREADING AND SYNCHRONIZATION. CS124 Operating Systems Fall , Lecture 10
MULTITHREADING AND SYNCHRONIZATION CS124 Operating Systems Fall 2017-2018, Lecture 10 2 Critical Sections Race conditions can be avoided by preventing multiple control paths from accessing shared state
More informationConcurrency and Synchronisation. Leonid Ryzhyk
Concurrency and Synchronisation Leonid Ryzhyk Textbook Sections 2.3 & 2.5 2 Concurrency in operating systems Inter-process communication web server SQL request DB Intra-process communication worker thread
More informationCSCI 350: Getting Started with C Written by: Stephen Tsung-Han Sher June 12, 2016
CSCI 350: Getting Started with C Written by: Stephen Tsung-Han Sher June 12, 2016 Introduction As you have been informed, your work with Pintos will be almost exclusively with C. Since you have taken CSCI-103
More informationComp 310 Computer Systems and Organization
Comp 310 Computer Systems and Organization Lecture #10 Process Management (CPU Scheduling & Synchronization) 1 Prof. Joseph Vybihal Announcements Oct 16 Midterm exam (in class) In class review Oct 14 (½
More informationPrecept 3: Preemptive Scheduler. COS 318: Fall 2018
Precept 3: Preemptive Scheduler COS 318: Fall 2018 Project 3 Schedule Precept: Monday 10/15, 7:30pm (You are here) Design Review: Monday 10/22, 3-7pm Due: Sunday 11/04, 11:55pm Project 3 Overview Goal:
More informationComputer architecture. A simplified model
Computer architecture A simplified model Computers architecture One (or several) CPU(s) Main memory A set of devices (peripherals) Interrupts Direct memory access Computers architecture Memory Keyboard
More informationTimers 1 / 46. Jiffies. Potent and Evil Magic
Timers 1 / 46 Jiffies Each timer tick, a variable called jiffies is incremented It is thus (roughly) the number of HZ since system boot A 32-bit counter incremented at 1000 Hz wraps around in about 50
More informationCPS 310 midterm exam #1, 2/19/2016
CPS 310 midterm exam #1, 2/19/2016 Your name please: NetID: Answer all questions. Please attempt to confine your answers to the boxes provided. For the execution tracing problem (P3) you may wish to use
More informationLast Class: Synchronization
Last Class: Synchronization Synchronization primitives are required to ensure that only one thread executes in a critical section at a time. Concurrent programs Low-level atomic operations (hardware) load/store
More informationAdministrivia. Review: Thread package API. Program B. Program A. Program C. Correct answers. Please ask questions on Google group
Administrivia Please ask questions on Google group - We ve had several questions that would likely be of interest to more students x86 manuals linked on reference materials page Next week, guest lecturer:
More informationInterprocess Communication and Synchronization
Chapter 2 (Second Part) Interprocess Communication and Synchronization Slide Credits: Jonathan Walpole Andrew Tanenbaum 1 Outline Race Conditions Mutual Exclusion and Critical Regions Mutex s Test-And-Set
More informationCSC Operating Systems Spring Lecture - XII Midterm Review. Tevfik Ko!ar. Louisiana State University. March 4 th, 2008.
CSC 4103 - Operating Systems Spring 2008 Lecture - XII Midterm Review Tevfik Ko!ar Louisiana State University March 4 th, 2008 1 I/O Structure After I/O starts, control returns to user program only upon
More informationImplementing Locks. Nima Honarmand (Based on slides by Prof. Andrea Arpaci-Dusseau)
Implementing Locks Nima Honarmand (Based on slides by Prof. Andrea Arpaci-Dusseau) Lock Implementation Goals We evaluate lock implementations along following lines Correctness Mutual exclusion: only one
More informationCSE306 - Homework2 and Solutions
CSE306 - Homework2 and Solutions Note: your solutions must contain enough information to enable the instructor to judge whether you understand the material or not. Simple yes/no answers do not count. A
More informationBackground. The Critical-Section Problem Synchronisation Hardware Inefficient Spinning Semaphores Semaphore Examples Scheduling.
Background The Critical-Section Problem Background Race Conditions Solution Criteria to Critical-Section Problem Peterson s (Software) Solution Concurrent access to shared data may result in data inconsistency
More informationPage 1. Goals for Today" Atomic Read-Modify-Write instructions" Examples of Read-Modify-Write "
Goals for Today" CS162 Operating Systems and Systems Programming Lecture 5 Semaphores, Conditional Variables" Atomic instruction sequence Continue with Synchronization Abstractions Semaphores, Monitors
More information