CS 153 Design of Operating Systems Spring 18

Size: px
Start display at page:

Download "CS 153 Design of Operating Systems Spring 18"

Transcription

1 CS 153 Design of Operating Systems Spring 18 Lectre 9: Synchronization (1) Instrctor: Chengy Song Slide contribtions from Nael Ab-Ghazaleh, Harsha Madhyvasta and Zhiyn Qian

2 Cooperation between Threads What is the prpose of threads? Threads cooperate in mltithreaded programs Why? To share resorces, access shared data strctres» Threads accessing a memory cache in a Web server To coordinate their exection» One thread exectes relative to another CS 153 Lectre 9 Synchronization 2

3 Threads: Sharing Data int nm_connections = 0; web_server() { while (1) { int sock = accept(); thread_fork(handle_reqest, sock); handle_reqest(int sock) { ++nm_connections; Process reqest close(sock); CS 153 Lectre 9 Synchronization 3

4 Threads: Cooperation Threads volntarily give p the CPU with thread_yield Ping Thread while (1) { printf( ping\n ); thread_yield(); Pong Thread while (1) { printf( pong\n ); thread_yield(); CS 153 Lectre 9 Synchronization 4

5 Synchronization For correctness, we need to control this cooperation Threads interleave exections arbitrarily and at different rates Schedling is not nder program control We control cooperation sing synchronization Synchronization enables s to restrict the possible interleavings of thread exections CS 153 Lectre 9 Synchronization 5

6 What abot processes? Does this apply to processes too? Yes! Processes are a little easier becase they don t share by defalt Bt share the OS strctres and machine resorces so we need to synchronize them too Basically, the OS is a mlti-threaded program CS 153 Lectre 9 Synchronization 6

7 Shared Resorces We initially focs on coordinating access to shared resorces Basic problem If two concrrent threads are accessing a shared variable, and that variable is read/modified/written by those threads, then access to the variable mst be controlled to avoid erroneos behavior Over the next cople of lectres, we will look at Exactly what problems occr How to bild mechanisms to control access to shared resorces» Locks, mtexes, semaphores, monitors, condition variables, etc. Patterns for coordinating accesses to shared resorces» Bonded bffer, prodcer-consmer, etc. CS 153 Lectre 9 Synchronization 7

8 A First Example Sppose we have to implement a fnction to handle withdrawals from a bank accont: withdraw (accont, amont) { balance = get_balance(accont); balance = balance amont; pt_balance(accont, balance); retrn balance; Now sppose that yo and yor father share a bank accont with a balance of $1000 Then yo each go to separate ATM machines and simltaneosly withdraw $100 from the accont CS 153 Lectre 9 Synchronization 8

9 Example Contined We ll represent the sitation by creating a separate thread for each person to do the withdrawals These threads rn on the same bank machine: withdraw (accont, amont) { balance = get_balance(accont); balance = balance amont; pt_balance(accont, balance); retrn balance; withdraw (accont, amont) { balance = get_balance(accont); balance = balance amont; pt_balance(accont, balance); retrn balance; What s the problem with this implementation? Think abot potential schedles of these two threads CS 153 Lectre 9 Synchronization 9

10 Interleaved Schedles The problem is that the exection of the two threads can be interleaved: Exection seqence seen by CPU balance = get_balance(accont); balance = balance amont; balance = get_balance(accont); balance = balance amont; pt_balance(accont, balance); pt_balance(accont, balance); Context switch What is the balance of the accont now? CS 153 Lectre 9 Synchronization 10

11 Shared Resorces Problem: two threads accessed a shared resorce Known as a race condition (remember this bzzword!) Need mechanisms to control this access So we can reason abot how the program will operate Or example was pdating a shared bank accont Also necessary for synchronizing access to any shared data strctre Bffers, qees, lists, hash tables, etc. CS 153 Lectre 9 Synchronization 11

12 When Are Resorces Stack (T1) Thread 1 Shared? Thread 2 Stack (T2) Stack (T3) Thread 3 Local variables? Not shared: refer to data on the stack Each thread has its own stack PC (T2) Never pass/share/store a pointer to a local variable on the stack for thread T1 to another thread T2 Heap Static Data Code PC (T3) PC (T1) Global variables and static objects? Shared: in static data segment, accessible by all threads Dynamic objects and other heap objects? Shared: Allocated from heap with malloc/free or new/delete CS 153 Lectre 9 Synchronization 12

13 How Interleaved Can It Get? How contorted can the interleavings be? We'll assme that the only atomic operations are reads and writes of individal memory locations Some architectres don't even give yo that! We'll assme that a context switch can occr at any time We'll assme that yo can delay a thread as long as yo like as long as it's not delayed forever... get_balance(accont); balance = get_balance(accont); balance =... balance = balance amont; balance = balance amont; pt_balance(accont, balance); pt_balance(accont, balance); CS 153 Lectre 9 Synchronization 13

14 What do we do abot it? Does this problem matter in practice? Are there other concrrency problems? And, if so, how do we solve it? Really difficlt becase behavior can be different every time How do we handle concrrency in real life? CS 153 Lectre 9 Synchronization 14

15 Mtal Exclsion Mtal exclsion to synchronize access to shared resorces This allows s to have larger atomic blocks What does atomic mean? Code that ses mtal called a Only one thread at a time can execte in the All other threads are forced to wait on entry When a thread leaves a, another can enter Example: sharing an ATM with others What reqirements wold yo place on a critical section? CS 153 Lectre 9 Synchronization 15

16 Critical Section Reqirements Critical sections have the following reqirements: 1) Mtal exclsion (mtex) 2) Progress If one thread is in the, then no other is A thread in the will eventally leave the critical section If some thread T is not in the, then T cannot prevent some other thread S from entering the 3) Bonded waiting (no starvation) If some thread T is waiting on the, then T will eventally enter the 4) Performance The overhead of entering and exiting the is small with respect to the work being done within it CS 153 Lectre 9 Synchronization 16

17 Abot Reqirements There are three kinds of reqirements that we'll se Safety property: nothing bad happens Mtex Liveness property: something good happens Progress, Bonded Waiting Performance reqirement Performance Properties hold for each rn, while performance depends on all the rns Rle of thmb: When designing a concrrent algorithm, worry abot safety first (bt don't forget liveness!). CS 153 Lectre 9 Synchronization 17

18 Mechanisms For Bilding Critical Sections Locks Primitive, minimal semantics, sed to bild others Semaphores Basic, easy to get the hang of, bt hard to program with Monitors High-level, reqires langage spport, operations implicit Architectre help Atomic read/write» Can it be done? CS 153 Lectre 9 Synchronization 18

19 How do we implement a lock? First try pthread_trylock(mtex) { if (mtex==0) { mtex= 1; retrn 1; else retrn 0; Thread 0, 1, //time to access critical region while(!pthread_trylock(mtex); // wait <critical region> pthread_nlock(mtex) Does this work? Assme reads/writes are atomic The lock itself is a critical region! Chicken and egg Compter scientist strggled with how to create software locks CS 153 Lectre 9 Synchronization 19

20 Second try int trn = 1; while (tre) { while (trn!= 1) ; trn = 2; otside of while (tre) { while (trn!= 2) ; trn = 1; otside of This is called alternation It satisfies mtex: If ble is in the, then trn == 1 and if yellow is in the then trn == 2 (trn == 1) (trn!= 2) Is there anything wrong with this soltion? CS 153 Lectre 9 Synchronization 20

21 Third try two variables Bool flag[2] while (flag[1]!= 0); flag[0] = 1; flag[0]=0; otside of while (flag[0]!= 0); flag[1] = 1; flag[1]=0; otside of We added two variables to try to break the race for the same variable Is there anything wrong with this soltion? CS 153 Lectre 9 Synchronization 21

22 Forth try set before yo check Bool flag[2] flag[0] = 1; while (flag[1]!= 0); flag[0]=0; otside of flag[1] = 1; while (flag[0]!= 0); flag[1]=0; otside of Is there anything wrong with this soltion? CS 153 Lectre 9 Synchronization 22

23 Fifth try doble check and back off Bool flag[2] flag[0] = 1; while (flag[1]!= 0) { flag[0]=0; flag[0] = 0; wait a short time; flag[0] = 1; otside of flag[1] = 1; while (flag[0]!= 0) { flag[1]=0; flag[1] = 0; wait a short time; flag[1] = 1; otside of CS 153 Lectre 9 Synchronization 23

24 Six try Dekker s Algorithm Bool flag[2]l Int trn = 1; flag[0] = 1; while (flag[1]!= 0) { //while if(trn == 2) { flag[0] = 0; while (trn == 2); flag[0] = 1; //if flag[0]=0; trn=2; otside of flag[1] = 1; while (flag[0]!= 0) { //while if(trn == 1) { flag[1] = 0; while (trn == 1); flag[1] = 1; //if flag[1]=0; trn=1; otside of CS 153 Lectre 9 Synchronization 24

25 Peterson's Algorithm int trn = 1; bool try1 = false, try2 = false; while (tre) { try1 = tre; trn = 2; while (try2 && trn!= 1) ; try1 = false; otside of while (tre) { try2 = tre; trn = 1; while (try1 && trn!= 2) ; try2 = false; otside of This satisfies all the reqirements Here's why... CS 153 Lectre 9 Synchronization 26

26 Peterson's Algorithm: analysis int trn = 1; bool try1 = false, try2 = false; while (tre) { { try1 (trn == 1 trn == 2) 1 try1 = tre; { try1 (trn == 1 trn == 2) 2 trn = 2; { try1 (trn == 1 trn == 2) 3 while (try2 && trn!= 1) ; { try1 (trn == 1 try2 (try2 (yellow at 6 or at 7)) 4 try1 = false; { try1 (trn == 1 trn == 2) otside of while (tre) { { try2 (trn == 1 trn == 2) 5 try2 = tre; { try2 (trn == 1 trn == 2) 6 trn = 1; { try2 (trn == 1 trn == 2) 7 while (try1 && trn!= 2) ; { try2 (trn == 2 try1 (try1 (ble at 2 or at 3)) 8 try2 = false; { try2 (trn == 1 trn == 2) otside of (ble at 4) try1 (trn == 1 try2 (try2 (yellow at 6 or at 7)) (yellow at 8) try2 (trn == 2 try1 (try1 (ble at 2 or at 3))... (trn == 1 trn == 2) CS 153 Lectre 9 Synchronization 27

27 Some observations This stff (software locks) is hard Hard to get right Hard to prove right It also is inefficient A spin lock waiting by checking the condition repeatedly Even better, software locks don t really work Compiler and hardware reorder memory references from different threads Something called memory consistency model Well beyond the scope of this class J So, we need to find a different way Hardware help; more in a second CS 153 Lectre 9 Synchronization 28

CS 153 Design of Operating Systems Spring 18

CS 153 Design of Operating Systems Spring 18 CS 153 Design of Operating Systems Spring 18 Lectre 10: Lock Implementation Instrctor: Chengy Song Slide contribtions from Nael Ab-Ghazaleh, Harsha Madhyvasta and Zhiyn Qian Recap: Synchronization Race

More information

CSE 153 Design of Operating Systems

CSE 153 Design of Operating Systems CSE 153 Design of Operating Systems Winter 19 Lecture 7/8: Synchronization (1) Administrivia How is Lab going? Be prepared with questions for this weeks Lab My impression from TAs is that you are on track

More information

CS 153 Design of Operating Systems Spring 18

CS 153 Design of Operating Systems Spring 18 CS 153 Design of Operating Systems Spring 18 Lectre 11: Semaphores Instrctor: Chengy Song Slide contribtions from Nael Ab-Ghazaleh, Harsha Madhyvasta and Zhiyn Qian Last time Worked throgh software implementation

More information

CSE 153 Design of Operating Systems Fall 2018

CSE 153 Design of Operating Systems Fall 2018 CSE 153 Design of Operating Systems Fall 2018 Lecture 5: Threads/Synchronization Implementing threads l Kernel Level Threads l u u All thread operations are implemented in the kernel The OS schedules all

More information

CS 153 Design of Operating Systems Spring 18

CS 153 Design of Operating Systems Spring 18 CS 153 Design of Operating Systems Spring 18 Lectre 8: Threads Instrctor: Chengy Song Slide contribtions from Nael Ab-Ghazaleh, Harsha Madhyvasta and Zhiyn Qian Processes P1 P2 Recall that Bt OS A process

More information

CS 153 Design of Operating Systems Winter 2016

CS 153 Design of Operating Systems Winter 2016 CS 153 Design of Operating Systems Winter 2016 Lecture 7: Synchronization Administrivia Homework 1 Due today by the end of day Hopefully you have started on project 1 by now? Kernel-level threads (preemptable

More information

CS 153 Design of Operating Systems Spring 18

CS 153 Design of Operating Systems Spring 18 CS 153 Design of Operating Systems Spring 18 Lectre 12: Deadlock Instrctor: Chengy Song Slide contribtions from Nael Ab-Ghazaleh, Harsha Madhyvasta and Zhiyn Qian Deadlock the deadly embrace! Synchronization

More information

CS 153 Design of Operating Systems

CS 153 Design of Operating Systems CS 153 Design of Operating Systems Spring 18 Lectre 3: OS model and Architectral Spport Instrctor: Chengy Song Slide contribtions from Nael Ab-Ghazaleh, Harsha Madhyvasta and Zhiyn Qian Last time/today

More information

CS 153 Design of Operating Systems Spring 18

CS 153 Design of Operating Systems Spring 18 CS 153 Design of Operating Systems Spring 18 Midterm Review Midterm in class on Friday (May 4) Covers material from arch spport to deadlock Based pon lectre material and modles of the book indicated on

More information

CS 153 Design of Operating Systems Spring 18

CS 153 Design of Operating Systems Spring 18 CS 153 Design of Operating Systems Spring 18 Lectre 15: Virtal Address Space Instrctor: Chengy Song Slide contribtions from Nael Ab-Ghazaleh, Harsha Madhyvasta and Zhiyn Qian OS Abstractions Applications

More information

CS 153 Design of Operating Systems Spring 18

CS 153 Design of Operating Systems Spring 18 CS 153 Design of Operating Systems Spring 18 Lectre 2: Historical Perspective Instrctor: Chengy Song Slide contribtions from Nael Ab-Ghazaleh, Harsha Madhyvasta and Zhiyn Qian Last time What is an OS?

More information

Lecture 5: Synchronization w/locks

Lecture 5: Synchronization w/locks Lecture 5: Synchronization w/locks CSE 120: Principles of Operating Systems Alex C. Snoeren Lab 1 Due 10/19 Threads Are Made to Share Global variables and static objects are shared Stored in the static

More information

CS 153 Design of Operating Systems

CS 153 Design of Operating Systems CS 153 Design of Operating Systems Spring 18 Lectre 23: File Systems (2) Instrctor: Chengy Song Slide contribtions from Nael Ab-Ghazaleh, Harsha Madhyvasta and Zhiyn Qian Last time Abstractions for the

More information

CS 153 Design of Operating Systems

CS 153 Design of Operating Systems CS 153 Design of Operating Systems Spring 18 Lectre 25: Dynamic Memory (1) Instrctor: Chengy Song Slide contribtions from Nael Ab-Ghazaleh, Harsha Madhyvasta and Zhiyn Qian Some slides modified from originals

More information

CS 153 Design of Operating Systems Spring 18

CS 153 Design of Operating Systems Spring 18 CS 53 Design of Operating Systems Spring 8 Lectre 2: Virtal Memory Instrctor: Chengy Song Slide contribtions from Nael Ab-Ghazaleh, Harsha Madhyvasta and Zhiyn Qian Recap: cache Well-written programs exhibit

More information

CS 153 Design of Operating Systems

CS 153 Design of Operating Systems CS 153 Design of Operating Systems Spring 18 Lectre 26: Dynamic Memory (2) Instrctor: Chengy Song Slide contribtions from Nael Ab-Ghazaleh, Harsha Madhyvasta and Zhiyn Qian Some slides modified from originals

More information

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

CSE 451: Operating Systems Winter Lecture 7 Synchronization. Steve Gribble. Synchronization. Threads cooperate in multithreaded programs CSE 451: Operating Systems Winter 2005 Lecture 7 Synchronization Steve Gribble Synchronization Threads cooperate in multithreaded programs to share resources, access shared data structures e.g., threads

More information

CS 153 Design of Operating Systems

CS 153 Design of Operating Systems CS 153 Design of Operating Systems Spring 18 Lectre 17: Advanced Paging Instrctor: Chengy Song Slide contribtions from Nael Ab-Ghazaleh, Harsha Madhyvasta and Zhiyn Qian Some slides modified from originals

More information

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

CSE 451: Operating Systems Winter Lecture 7 Synchronization. Hank Levy 412 Sieg Hall CSE 451: Operating Systems Winter 2003 Lecture 7 Synchronization Hank Levy Levy@cs.washington.edu 412 Sieg Hall Synchronization Threads cooperate in multithreaded programs to share resources, access shared

More information

CS 153 Design of Operating Systems

CS 153 Design of Operating Systems CS 53 Design of Operating Systems Spring 8 Lectre 9: Locality and Cache Instrctor: Chengy Song Slide contribtions from Nael Ab-Ghazaleh, Harsha Madhyvasta and Zhiyn Qian Some slides modified from originals

More information

Synchronization I. Jo, Heeseung

Synchronization I. Jo, Heeseung Synchronization I Jo, Heeseung Today's Topics Synchronization problem Locks 2 Synchronization Threads cooperate in multithreaded programs To share resources, access shared data structures Also, to coordinate

More information

Dealing with Issues for Interprocess Communication

Dealing with Issues for Interprocess Communication Dealing with Issues for Interprocess Communication Ref Section 2.3 Tanenbaum 7.1 Overview Processes frequently need to communicate with other processes. In a shell pipe the o/p of one process is passed

More information

CS 31: Introduction to Computer Systems : Threads & Synchronization April 16-18, 2019

CS 31: Introduction to Computer Systems : Threads & Synchronization April 16-18, 2019 CS 31: Introduction to Computer Systems 22-23: Threads & Synchronization April 16-18, 2019 Making Programs Run Faster We all like how fast computers are In the old days (1980 s - 2005): Algorithm too slow?

More information

CS 153 Design of Operating Systems Spring 18

CS 153 Design of Operating Systems Spring 18 CS 153 Design of Operating Systems Spring 18 Lectre 1: Corse Introdction Instrctor: Chengy Song Slide contribtions from Nael Ab-Ghazaleh, Harsha Madhyvasta and Zhiyn Qian Teaching Staff Chengy Song I am

More information

CS 153 Design of Operating Systems

CS 153 Design of Operating Systems CS 53 Design of Operating Systems Spring 8 Lectre 6: Paging Instrctor: Chengy Song Slide contribtions from Nael Ab-Ghazaleh, Harsha Madhyvasta and Zhiyn Qian Some slides modified from originals by Dave

More information

Synchronization I. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Synchronization I. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University Synchronization I Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Today s Topics Synchronization problem Locks 2 Synchronization Threads cooperate

More information

CS 153 Design of Operating Systems

CS 153 Design of Operating Systems CS 153 Design of Operating Systems Spring 18 Lectre 18: Memory Hierarchy Instrctor: Chengy Song Slide contribtions from Nael Ab-Ghazaleh, Harsha Madhyvasta and Zhiyn Qian Some slides modified from originals

More information

(2, 4) Tree Example (2, 4) Tree: Insertion

(2, 4) Tree Example (2, 4) Tree: Insertion Presentation for se with the textbook, Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015 B-Trees and External Memory (2, 4) Trees Each internal node has 2 to 4 children:

More information

Making Full Use of Multi-Core ECUs with AUTOSAR Basic Software Distribution

Making Full Use of Multi-Core ECUs with AUTOSAR Basic Software Distribution Making Fll Use of Mlti-Core ECUs with AUTOSAR Basic Software Distribtion Webinar V0.1 2018-09-07 Agenda Motivation for Mlti-Core AUTOSAR Standard: SWC-Split MICROSAR Extension: BSW-Split BSW-Split: Technical

More information

10/17/ Gribble, Lazowska, Levy, Zahorjan 2. 10/17/ Gribble, Lazowska, Levy, Zahorjan 4

10/17/ Gribble, Lazowska, Levy, Zahorjan 2. 10/17/ Gribble, Lazowska, Levy, Zahorjan 4 Temporal relations CSE 451: Operating Systems Autumn 2010 Module 7 Synchronization Instructions executed by a single thread are totally ordered A < B < C < Absent synchronization, instructions executed

More information

Synchronization. CS61, Lecture 18. Prof. Stephen Chong November 3, 2011

Synchronization. CS61, Lecture 18. Prof. Stephen Chong November 3, 2011 Synchronization CS61, Lecture 18 Prof. Stephen Chong November 3, 2011 Announcements Assignment 5 Tell us your group by Sunday Nov 6 Due Thursday Nov 17 Talks of interest in next two days Towards Predictable,

More information

Operating Systems. Synchronization

Operating Systems. Synchronization Operating Systems Fall 2014 Synchronization Myungjin Lee myungjin.lee@ed.ac.uk 1 Temporal relations Instructions executed by a single thread are totally ordered A < B < C < Absent synchronization, instructions

More information

Concurrency Control. Synchronization. Brief Preview of Scheduling. Motivating Example. Motivating Example (Cont d) Interleaved Schedules

Concurrency Control. Synchronization. Brief Preview of Scheduling. Motivating Example. Motivating Example (Cont d) Interleaved Schedules Brief Preview of Scheduling Concurrency Control Nan Niu (nn@cs.toronto.edu) CSC309 -- Summer 2008 Multiple threads ready to run Some mechanism for switching between them Context switches Some policy for

More information

Requirements Engineering. Objectives. System requirements. Types of requirements. FAQS about requirements. Requirements problems

Requirements Engineering. Objectives. System requirements. Types of requirements. FAQS about requirements. Requirements problems Reqirements Engineering Objectives An introdction to reqirements Gerald Kotonya and Ian Sommerville To introdce the notion of system reqirements and the reqirements process. To explain how reqirements

More information

Chapter 3 & Appendix C Pipelining Part A: Basic and Intermediate Concepts

Chapter 3 & Appendix C Pipelining Part A: Basic and Intermediate Concepts CS359: Compter Architectre Chapter 3 & Appendi C Pipelining Part A: Basic and Intermediate Concepts Yanyan Shen Department of Compter Science and Engineering Shanghai Jiao Tong University 1 Otline Introdction

More information

Prof. Kozyrakis. 1. (10 points) Consider the following fragment of Java code:

Prof. Kozyrakis. 1. (10 points) Consider the following fragment of Java code: EE8 Winter 25 Homework #2 Soltions De Thrsday, Feb 2, 5 P. ( points) Consider the following fragment of Java code: for (i=; i

More information

Chapter 6: Process [& Thread] Synchronization. CSCI [4 6] 730 Operating Systems. Why does cooperation require synchronization?

Chapter 6: Process [& Thread] Synchronization. CSCI [4 6] 730 Operating Systems. Why does cooperation require synchronization? Chapter 6: Process [& Thread] Synchronization CSCI [4 6] 730 Operating Systems Synchronization Part 1 : The Basics Why is synchronization needed? Synchronization Language/Definitions:» What are race conditions?»

More information

! Why is synchronization needed? ! Synchronization Language/Definitions: ! How are locks implemented? Maria Hybinette, UGA

! Why is synchronization needed? ! Synchronization Language/Definitions: ! How are locks implemented? Maria Hybinette, UGA Chapter 6: Process [& Thread] Synchronization CSCI [4 6] 730 Operating Systems Synchronization Part 1 : The Basics! Why is synchronization needed?! Synchronization Language/Definitions:» What are race

More information

Lecture 4: Routing. CSE 222A: Computer Communication Networks Alex C. Snoeren. Thanks: Amin Vahdat

Lecture 4: Routing. CSE 222A: Computer Communication Networks Alex C. Snoeren. Thanks: Amin Vahdat Lectre 4: Roting CSE 222A: Compter Commnication Networks Alex C. Snoeren Thanks: Amin Vahdat Lectre 4 Overview Pop qiz Paxon 95 discssion Brief intro to overlay and active networking 2 End-to-End Roting

More information

Review. A single-cycle MIPS processor

Review. A single-cycle MIPS processor Review If three instrctions have opcodes, 7 and 5 are they all of the same type? If we were to add an instrction to IPS of the form OD $t, $t2, $t3, which performs $t = $t2 OD $t3, what wold be its opcode?

More information

Putting the dynamic into software security testing

Putting the dynamic into software security testing Ptting the dynamic into software secrity testing Detecting and Addressing Cybersecrity Isses V1.1 2018-03-05 Code ahead! 2 Atomated vlnerability detection and triage + = 3 How did we get here? Vector was

More information

Advance Operating Systems (CS202) Locks Discussion

Advance Operating Systems (CS202) Locks Discussion Advance Operating Systems (CS202) Locks Discussion Threads Locks Spin Locks Array-based Locks MCS Locks Sequential Locks Road Map Threads Global variables and static objects are shared Stored in the static

More information

CS 153 Design of Operating Systems Winter 2016

CS 153 Design of Operating Systems Winter 2016 CS 153 Design of Operating Systems Winter 2016 Lecture 6: Threads Recap: Process Components Per- Process State Per- Thread State A process is named using its process ID (PID) A process contains all of

More information

CAPL Scripting Quickstart

CAPL Scripting Quickstart CAPL Scripting Qickstart CAPL (Commnication Access Programming Langage) For CANalyzer and CANoe V1.01 2015-12-03 Agenda Important information before getting started 3 Visal Seqencer (GUI based programming

More information

VirtuOS: an operating system with kernel virtualization

VirtuOS: an operating system with kernel virtualization VirtOS: an operating system with kernel virtalization Rslan Nikolaev, Godmar Back SOSP '13 Proceedings of the Twenty-Forth ACM Symposim on Oper ating Systems Principles 이영석, 신현호, 박재완 Index Motivation Design

More information

Tdb: A Source-level Debugger for Dynamically Translated Programs

Tdb: A Source-level Debugger for Dynamically Translated Programs Tdb: A Sorce-level Debgger for Dynamically Translated Programs Naveen Kmar, Brce R. Childers, and Mary Lo Soffa Department of Compter Science University of Pittsbrgh Pittsbrgh, Pennsylvania 15260 {naveen,

More information

Lecture 13: Exceptions and Interrupts

Lecture 13: Exceptions and Interrupts 18 447 Lectre 13: Eceptions and Interrpts S 10 L13 1 James C. Hoe Dept of ECE, CU arch 1, 2010 Annoncements: Handots: Spring break is almost here Check grades on Blackboard idterm 1 graded Handot #9: Lab

More information

G52CON: Concepts of Concurrency

G52CON: Concepts of Concurrency G52CON: Concepts of Concurrency Lecture 6: Algorithms for Mutual Natasha Alechina School of Computer Science nza@cs.nott.ac.uk Outline of this lecture mutual exclusion with standard instructions example:

More information

Dynamic Maintenance of Majority Information in Constant Time per Update? Gudmund S. Frandsen and Sven Skyum BRICS 1 Department of Computer Science, Un

Dynamic Maintenance of Majority Information in Constant Time per Update? Gudmund S. Frandsen and Sven Skyum BRICS 1 Department of Computer Science, Un Dynamic Maintenance of Majority Information in Constant Time per Update? Gdmnd S. Frandsen and Sven Skym BRICS 1 Department of Compter Science, University of arhs, Ny Mnkegade, DK-8000 arhs C, Denmark

More information

EXAMINATIONS 2010 END OF YEAR NWEN 242 COMPUTER ORGANIZATION

EXAMINATIONS 2010 END OF YEAR NWEN 242 COMPUTER ORGANIZATION EXAINATIONS 2010 END OF YEAR COPUTER ORGANIZATION Time Allowed: 3 Hors (180 mintes) Instrctions: Answer all qestions. ake sre yor answers are clear and to the point. Calclators and paper foreign langage

More information

Illumina LIMS. Software Guide. For Research Use Only. Not for use in diagnostic procedures. Document # June 2017 ILLUMINA PROPRIETARY

Illumina LIMS. Software Guide. For Research Use Only. Not for use in diagnostic procedures. Document # June 2017 ILLUMINA PROPRIETARY Illmina LIMS Software Gide Jne 2017 ILLUMINA PROPRIETARY This docment and its contents are proprietary to Illmina, Inc. and its affiliates ("Illmina"), and are intended solely for the contractal se of

More information

Lecture 4: Threads; weaving control flow

Lecture 4: Threads; weaving control flow Lecture 4: Threads; weaving control flow CSE 120: Principles of Operating Systems Alex C. Snoeren HW 1 Due NOW Announcements Homework #1 due now Project 0 due tonight Project groups Please send project

More information

5 Performance Evaluation

5 Performance Evaluation 5 Performance Evalation his chapter evalates the performance of the compared to the MIP, and FMIP individal performances. We stdy the packet loss and the latency to restore the downstream and pstream of

More information

EXAMINATIONS 2003 END-YEAR COMP 203. Computer Organisation

EXAMINATIONS 2003 END-YEAR COMP 203. Computer Organisation EXAINATIONS 2003 COP203 END-YEAR Compter Organisation Time Allowed: 3 Hors (180 mintes) Instrctions: Answer all qestions. There are 180 possible marks on the eam. Calclators and foreign langage dictionaries

More information

CSE 120 Principles of Operating Systems

CSE 120 Principles of Operating Systems CSE 120 Principles of Operating Systems Spring 2009 Lecture 4: Threads Geoffrey M. Voelker Announcements Homework #1 due now Project 0 due tonight Project 1 out April 9, 2009 CSE 120 Lecture 4 Threads

More information

CS-537: Midterm Exam (Spring 2001)

CS-537: Midterm Exam (Spring 2001) CS-537: Midterm Exam (Spring 2001) Please Read All Questions Carefully! There are seven (7) total numbered pages Name: 1 Grading Page Points Total Possible Part I: Short Answers (12 5) 60 Part II: Long

More information

CSE 120 Principles of Operating Systems

CSE 120 Principles of Operating Systems CSE 120 Principles of Operating Systems Fall 2000 Lecture 5: Threads Geoffrey M. Voelker Processes Recall that a process includes many things An address space (defining all the code and data pages) OS

More information

CS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring 2002

CS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring 2002 CS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring 2002 Lecture 6: Synchronization 6.0 Main points More concurrency examples Synchronization primitives 6.1 A Larger Concurrent

More information

Operating Systems. Sina Meraji U of T

Operating Systems. Sina Meraji U of T Operating Systems Sina Meraji U of T 1 Announcement Check discussion board for announcements A1 is posted 2 Recap: Process Creation: Unix In Unix, processes are created using fork() int fork() fork() Creates

More information

CSCI [4 6] 730 Operating Systems. Example Execution. Process [& Thread] Synchronization. Why does cooperation require synchronization?

CSCI [4 6] 730 Operating Systems. Example Execution. Process [& Thread] Synchronization. Why does cooperation require synchronization? Process [& Thread] Synchronization CSCI [4 6] 730 Operating Systems Synchronization Part 1 : The Basics Why is synchronization needed? Synchronization Language/Definitions: What are race conditions? What

More information

Why do we care about parallel?

Why do we care about parallel? Threads 11/15/16 CS31 teaches you How a computer runs a program. How the hardware performs computations How the compiler translates your code How the operating system connects hardware and software The

More information

Networks An introduction to microcomputer networking concepts

Networks An introduction to microcomputer networking concepts Behavior Research Methods& Instrmentation 1978, Vol 10 (4),522-526 Networks An introdction to microcompter networking concepts RALPH WALLACE and RICHARD N. JOHNSON GA TX, Chicago, Illinois60648 and JAMES

More information

EECS 482 Introduction to Operating Systems

EECS 482 Introduction to Operating Systems EECS 482 Introduction to Operating Systems Winter 2018 Baris Kasikci Slides by: Harsha V. Madhyastha http://knowyourmeme.com/memes/mind-blown 2 Recap: Processes Hardware interface: app1+app2+app3 CPU +

More information

BIS - Basic Package V4.6

BIS - Basic Package V4.6 Engineered Soltions BIS - Basic Package V4.6 BIS - Basic Package V4.6 www.boschsecrity.com The Bilding Integration System (BIS) BIS is a flexible, scalable secrity and safety management system that can

More information

CSE 120 Principles of Operating Systems

CSE 120 Principles of Operating Systems CSE 120 Principles of Operating Systems Fall 2015 Lecture 4: Threads Geoffrey M. Voelker Announcements Project 0 due Project 1 out October 6, 2015 CSE 120 Lecture 4 Threads 2 Processes Recall that a process

More information

Advanced Operating Systems (CS 202) Memory Consistency, Cache Coherence and Synchronization

Advanced Operating Systems (CS 202) Memory Consistency, Cache Coherence and Synchronization Advanced Operating Systems (CS 202) Memory Consistency, Cache Coherence and Synchronization Jan, 27, 2017 (some cache coherence slides adapted from Ian Watson; some memory consistency slides from Sarita

More information

A choice relation framework for supporting category-partition test case generation

A choice relation framework for supporting category-partition test case generation Title A choice relation framework for spporting category-partition test case generation Athor(s) Chen, TY; Poon, PL; Tse, TH Citation Ieee Transactions On Software Engineering, 2003, v. 29 n. 7, p. 577-593

More information

BIS - Basic Package V4.4

BIS - Basic Package V4.4 Engineered Soltions BIS - Basic Package V4.4 BIS - Basic Package V4.4 www.boschsecrity.com Integration of Bosch and third party systems via open interfaces and SDK All relevant information in one ser interface

More information

BIS - Basic package V4.3

BIS - Basic package V4.3 Engineered Soltions BIS - Basic package V4.3 BIS - Basic package V4.3 www.boschsecrity.com Integration of Bosch and third party systems throgh deployment of OPC All relevant information in one ser interface

More information

TAKING THE PULSE OF ICT IN HEALTHCARE

TAKING THE PULSE OF ICT IN HEALTHCARE ICT TODAY THE OFFICIAL TRADE JOURNAL OF BICSI Janary/Febrary 2016 Volme 37, Nmber 1 TAKING THE PULSE OF ICT IN HEALTHCARE + PLUS + High-Power PoE + Using HDBaseT in AV Design for Schools + Focs on Wireless

More information

How to Request Space through the Call for Programs Students. Center for Student Involvement Northeastern University

How to Request Space through the Call for Programs Students. Center for Student Involvement Northeastern University How to Reqest Space throgh the Call for Programs Stdents Center for Stdent Involvement Northeastern University 2017-2018 BEFORE YOU BEGIN Check to make sre that yo can access NUSSO via MyNEU Only the President,

More information

Pipelined van Emde Boas Tree: Algorithms, Analysis, and Applications

Pipelined van Emde Boas Tree: Algorithms, Analysis, and Applications This fll text paper was peer reviewed at the direction of IEEE Commnications Society sbject matter experts for pblication in the IEEE INFOCOM 007 proceedings Pipelined van Emde Boas Tree: Algorithms, Analysis,

More information

Review Multicycle: What is Happening. Controlling The Multicycle Design

Review Multicycle: What is Happening. Controlling The Multicycle Design Review lticycle: What is Happening Reslt Zero Op SrcA SrcB Registers Reg Address emory em Data Sign etend Shift left Sorce A B Ot [-6] [5-] [-6] [5-] [5-] Instrction emory IR RegDst emtoreg IorD em em

More information

BIS - Basic package V4.2

BIS - Basic package V4.2 Engineered Soltions BIS - Basic package V4.2 BIS - Basic package V4.2 www.boschsecrity.com Integration of Bosch and third party systems throgh deployment of OPC All relevant information in one ser interface

More information

Pavlin and Daniel D. Corkill. Department of Computer and Information Science University of Massachusetts Amherst, Massachusetts 01003

Pavlin and Daniel D. Corkill. Department of Computer and Information Science University of Massachusetts Amherst, Massachusetts 01003 From: AAAI-84 Proceedings. Copyright 1984, AAAI (www.aaai.org). All rights reserved. SELECTIVE ABSTRACTION OF AI SYSTEM ACTIVITY Jasmina Pavlin and Daniel D. Corkill Department of Compter and Information

More information

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

Operating 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 information

Example Threads. compile: gcc mythread.cc -o mythread -lpthread What is the output of this program? #include <pthread.h> #include <stdio.

Example Threads. compile: gcc mythread.cc -o mythread -lpthread What is the output of this program? #include <pthread.h> #include <stdio. Example Threads #include #include int num = 0; void *add_one(int *thread_num) { num++; printf("thread %d num = %d\n", *thread_num, num); } void main() { pthread_t thread; int my_id

More information

Lecture 14: Congestion Control

Lecture 14: Congestion Control Lectre 14: Congestion Control CSE 222A: Compter Commnication Networks George Porter Thanks: Amin Vahdat, Dina Katabi Lectre 14 Overview TCP congestion control review XCP Overview CSE 222A Lectre 14: Congestion

More information

SPIN, PETERSON AND BAKERY LOCKS

SPIN, PETERSON AND BAKERY LOCKS Concurrent Programs reasoning about their execution proving correctness start by considering execution sequences CS4021/4521 2018 jones@scss.tcd.ie School of Computer Science and Statistics, Trinity College

More information

EEC 483 Computer Organization. Branch (Control) Hazards

EEC 483 Computer Organization. Branch (Control) Hazards EEC 483 Compter Organization Section 4.8 Branch Hazards Section 4.9 Exceptions Chans Y Branch (Control) Hazards While execting a previos branch, next instrction address might not yet be known. s n i o

More information

EECE.4810/EECE.5730: Operating Systems Spring 2017 Homework 2 Solution

EECE.4810/EECE.5730: Operating Systems Spring 2017 Homework 2 Solution 1. (15 points) A system with two dual-core processors has four processors available for scheduling. A CPU-intensive application (e.g., a program that spends most of its time on computation, not I/O or

More information

Isilon InsightIQ. Version 2.5. User Guide

Isilon InsightIQ. Version 2.5. User Guide Isilon InsightIQ Version 2.5 User Gide Pblished March, 2014 Copyright 2010-2014 EMC Corporation. All rights reserved. EMC believes the information in this pblication is accrate as of its pblication date.

More information

Computer User s Guide 4.0

Computer User s Guide 4.0 Compter User s Gide 4.0 2001 Glenn A. Miller, All rights reserved 2 The SASSI Compter User s Gide 4.0 Table of Contents Chapter 1 Introdction...3 Chapter 2 Installation and Start Up...5 System Reqirements

More information

Parallel Computer Architecture Spring Memory Consistency. Nikos Bellas

Parallel Computer Architecture Spring Memory Consistency. Nikos Bellas Parallel Computer Architecture Spring 2018 Memory Consistency Nikos Bellas Computer and Communications Engineering Department University of Thessaly Parallel Computer Architecture 1 Coherence vs Consistency

More information

Introduction to Algorithms. Minimum Spanning Tree. Chapter 23: Minimum Spanning Trees

Introduction to Algorithms. Minimum Spanning Tree. Chapter 23: Minimum Spanning Trees Introdction to lgorithms oncrete example Imagine: Yo wish to connect all the compters in an office bilding sing the least amont of cable - ach vertex in a graph G represents a compter - ach edge represents

More information

Exceptions and interrupts

Exceptions and interrupts Eceptions and interrpts An eception or interrpt is an nepected event that reqires the CPU to pase or stop the crrent program. Eception handling is the hardware analog of error handling in software. Classes

More information

POWER-OF-2 BOUNDARIES

POWER-OF-2 BOUNDARIES Warren.3.fm Page 5 Monday, Jne 17, 5:6 PM CHAPTER 3 POWER-OF- BOUNDARIES 3 1 Ronding Up/Down to a Mltiple of a Known Power of Ronding an nsigned integer down to, for eample, the net smaller mltiple of

More information

The extra single-cycle adders

The extra single-cycle adders lticycle Datapath As an added bons, we can eliminate some of the etra hardware from the single-cycle path. We will restrict orselves to sing each fnctional nit once per cycle, jst like before. Bt since

More information

CS 43: Computer Networks. 07: Concurrency and Non-blocking I/O Sep 17, 2018

CS 43: Computer Networks. 07: Concurrency and Non-blocking I/O Sep 17, 2018 CS 43: Computer Networks 07: Concurrency and Non-blocking I/O Sep 17, 2018 Reading Quiz Lecture 5 - Slide 2 Today Under-the-hood look at system calls Data buffering and blocking Inter-process communication

More information

Advanced Operating Systems (CS 202) Memory Consistency, Cache Coherence and Synchronization

Advanced Operating Systems (CS 202) Memory Consistency, Cache Coherence and Synchronization Advanced Operating Systems (CS 202) Memory Consistency, Cache Coherence and Synchronization (some cache coherence slides adapted from Ian Watson; some memory consistency slides from Sarita Adve) Classic

More information

dss-ip Manual digitalstrom Server-IP Operation & Settings

dss-ip Manual digitalstrom Server-IP Operation & Settings dss-ip digitalstrom Server-IP Manal Operation & Settings Table of Contents digitalstrom Table of Contents 1 Fnction and Intended Use... 3 1.1 Setting p, Calling p and Operating... 3 1.2 Reqirements...

More information

How to Request Space through the Call for Programs Students. Center for Student Involvement Northeastern University

How to Request Space through the Call for Programs Students. Center for Student Involvement Northeastern University How to Reqest Space throgh the Call for Programs Stdents Center for Stdent Involvement Northeastern University 2018-2019 BEFORE YOU BEGIN Check to make sre that yo can access NUSSO via MyNortheastern Only

More information

Synchronization. Dr. Yingwu Zhu

Synchronization. Dr. Yingwu Zhu Synchronization Dr. Yingwu Zhu Synchronization Threads cooperate in multithreaded programs To share resources, access shared data structures Threads accessing a memory cache in a Web server To coordinate

More information

Today s Lecture. Software Architecture. Lecture 27: Introduction to Software Architecture. Introduction and Background of

Today s Lecture. Software Architecture. Lecture 27: Introduction to Software Architecture. Introduction and Background of Today s Lectre Lectre 27: Introdction to Software Architectre Kenneth M. Anderson Fondations of Software Engineering CSCI 5828 - Spring Semester, 1999 Introdction and Backgrond of Software Architectre

More information

Minimum Spanning Trees Outline: MST

Minimum Spanning Trees Outline: MST Minimm Spanning Trees Otline: MST Minimm Spanning Tree Generic MST Algorithm Krskal s Algorithm (Edge Based) Prim s Algorithm (Vertex Based) Spanning Tree A spanning tree of G is a sbgraph which is tree

More information

CS153: Deadlock. Chengyu Song. Slides modified from Harsha Madhyvasta, Nael Abu-Ghazaleh, and Zhiyun Qian

CS153: Deadlock. Chengyu Song. Slides modified from Harsha Madhyvasta, Nael Abu-Ghazaleh, and Zhiyun Qian 1 CS153: Deadlock Chengyu Song Slides modified from Harsha Madhyvasta, Nael Abu-Ghazaleh, and Zhiyun Qian 2 Administrivia Lab Lab1 is due this Sunday Demo sessions next week Little book of semaphores First

More information

Parameterized Memory Models and Concurrent Separation Logic

Parameterized Memory Models and Concurrent Separation Logic Parameterized Memory Models and Concrrent Separation Logic Rodrigo Ferreira 1,XinyFeng 2, and Zhong Shao 1 1 Yale University {rodrigo.ferreira,zhong.shao}@yale.ed 2 Toyota Technological Institte at Chicago

More information

EMC AppSync. User Guide. Version REV 01

EMC AppSync. User Guide. Version REV 01 EMC AppSync Version 1.5.0 User Gide 300-999-948 REV 01 Copyright 2012-2013 EMC Corporation. All rights reserved. Pblished in USA. EMC believes the information in this pblication is accrate as of its pblication

More information

10/17/2011. Cooperating Processes. Synchronization 1. Example: Producer Consumer (3) Example

10/17/2011. Cooperating Processes. Synchronization 1. Example: Producer Consumer (3) Example Cooperating Processes Synchronization 1 Chapter 6.1 4 processes share something (devices such as terminal, keyboard, mouse, etc., or data structures) and can affect each other non deterministic Not exactly

More information

What the CPU Sees Basic Flow Control Conditional Flow Control Structured Flow Control Functions and Scope. C Flow Control.

What the CPU Sees Basic Flow Control Conditional Flow Control Structured Flow Control Functions and Scope. C Flow Control. C Flow Control David Chisnall February 1, 2011 Outline What the CPU Sees Basic Flow Control Conditional Flow Control Structured Flow Control Functions and Scope Disclaimer! These slides contain a lot of

More information