Thread-based vs Event-based Implementation of a Group Communication Service

Size: px
Start display at page:

Download "Thread-based vs Event-based Implementation of a Group Communication Service"

Transcription

1 Thread-based vs Event-based Implementation o a Group Communication Service Shivakant Mishra and Ronuan Yan Department o Computer Science University o Wyomin, P.O. Box 3682 Laramie, WY , USA. mishrajchon@cs.uwyo.edu Abstract We evaluate two techniques to implement concurrent events in a roup communication service. This evaluation is based on a comparison o the perormance measured rom two dierent implementations o a roup communication service, and our experience in usin the two techniques to implement roup communication services in the past. Our conclusion is that an event-based implementation is preerable to a thread-based implementation o a roup communication service. 1. Introduction Most roup communication services are event driven, i.e. roup members invoke various unctions on the occurrence o an event. In eneral, several events may occur concurrently at a roup member implementin a roup communication service. There are two common techniques to implement concurrent, event-driven sotware: thread-based and event-based. In the thread-based technique, a separate thread is spawned or each event type, say e type, in the proram. This thread waits or an event o type e type to occur and takes appropriate actions on the occurrence o that event. In the event-based technique, a sinle-threaded event loop perorms event demultiplexin and event handler dispatchin in response to the occurrence o multiple events. While both techniques have been used to handle concurrent events in roup communication services [2, 7, 3, 8, 1], it is not clear which o them is more suitable. The oal o this paper is to evaluate these two techniques in implementin roup communication services in terms o their eect on service perormance, complexity o their implementation, and portability. This evaluation is based on an implementation o two versions (event-based and thread-based) o the Timewheel roup communication service [5, 6], and our experience in usin these techniques to implement roup communication services in the past. The main conclusion is that an event-based technique is almost always preerable to a thread-based technique to handle concurrent events in roup communication services. An event-based implementation results in better perormance, simpler, more manaeable, and portable code. 2. Concurrent Events Events in a roup communication service occur due to interactions between a client and a roup member, interactions amon roup members, and various timeouts set by roup members. The Timewheel roup communication service [5, 6] consists o a clock synchronization protocol, a roup membership protocol, and an atomic broadcast protocol. It supports nine roup communication semantics: three kinds o orderin semantics no order, total ordered, and time ordered, three kinds o atomicity semantics weak, stron, andstrict, and one termination semantic. There are two types o interaction between a client and a roup member in the Timewheel roup communication service. A client can request to multicast a service state update with a iven pair o atomicity and order semantics, or it can request to retrieve some inormation about the replicated service state. There are two types o messaes sent by roup members to implement the Timewheel atomic broadcast protocol: a proposal messae to disseminate a service state update and a decision messae to disseminate ordinal inormation. There are three types o messaes exchaned amon members to implement the Timewheel membership protocol: a no-decision messae to inorm a ailure suspicion, a join messae to request joinin a roup, and a reconiuration messae to disseminate inormation about the list o live processes. Finally, the clock synchronization protocol uses a messae to synchronize clocks o dierent members.

2 The Timewheel roup communication service uses our types o timeouts: a decision messae timeout used to set a time by which the next decision messae is expected, a decider timeout used by a member(decider) to set a time by which the next decision messae is to be sent, a decider election timeout used by the membership protocol to elect a new decider, and a clock synchronization timeout used by the clock synchronization protocol to set a time when the next clock synchronization messae is to be sent. 3. Thread-Based Implementation The thread-based implementation o the Timewheel roup communication service uses the SGI s POSIXcompliant, pthreads library. Six threads are used in this implementation. One thread executes in a loop waitin to receive a request rom a client and, on receivin a request, invokes a unction to service that request. Another thread executes in a loop waitin to receive a messae rom the other members and, on receivin a messae, invokes a unction to process that messae. The remainin threads implement timers: one each in the atomic broadcast and clock synchronization protocols and two in the roup membership protocol. A timer is implemented as ollows: void timer(pthread mutex t *m, pthread cond t *c, struct timespec *interval) pthread mutex lock(m); pthread cond timedwait(c, m, interval); pthread mutex unlock(m); The reason or usin pthread cond timedwait unction, instead o a simple timed-wait unction to implement timers is that, in some cases, we need to unblock the timer thread beore the speciied time interval has passed. This can be done by pthread cond sinal unction call. Some o these timer threads are not always needed. For example, the second timer thread in the membership protocol is needed only when a ailure occurs and it is determined that the decider role has been lost. In our implementation, these timer threads are blocked on a pthread cond wait unction call, when they are not needed. They are unblocked by the pthread cond sinal unction call, when needed. Proress o the Timewheel roup communication service is dependent on the individual clocks o dierent processors bein synchronized. A roup member whose clock is not synchronized with the other members leaves the roup (See [4] or details). So, to ensure proress, the timer thread used by the clock synchronization protocol needs to be scheduled as soon as its timer expires. We ive this thread the hihest priority. The other ive threads are o equal priorities. A consequence o unequal priorities is that race conditions can occur between them, even when the service is implemented on a network o uni-processor systems 1. A runnin thread may et interrupted in the middle o executin a unction, and since all six threads execute in the same address space, the threads scheduled later may interere with the preempted thread. Unortunately, there is very little parallelism in roup communication services. In eneral, execution o a unction invoked by a thread must complete beore another thread can invoke a unction. So, to handle race conditions, we simply enclose most unctions by semaphores. To minimize the possibility o preemption o a runnin thread by the scheduler, we have used the io schedulin policy. To ensure that each o the ive equal-priority threads et a air share o the CPU, a runnin thread yields its control o CPU, whenever it inishes the execution o the unction invoked. 4. Event-Based Implementation There are six types o events in the event-based implementation o the Timewheel roup communication service. They correspond to the six threads in the thread-based implementation. An outline o the event loop and the processin o timeout events is shown below: void mainloop() or (;;) rset = readds; i (to ev queue!queue size() > ) to ev queue!et timeout(to); else to = NULL; ret = select(maxfd,&rset, NULL, NULL, to); i (ret == ) process to(); else or (int i = minfd; i < maxf D; i ++) i (FD ISSET(i,&rset)) ln = recvrom(i, sm, mlen,,null,&ret); event table[i]!new event(); void process to() int done =; to ev queue!irst!new event(); to ev queue!dequeue(); do 1 I the service is implemented on a network o multiprocessor systems, race conditions between threads can occur even when all threads are o equal priorities. This can happen i the thread packae can schedule more than one thread concurrently at dierent processors.

3 i (time over(clk sync to!time)) to ev queue!remove event(clk sync to); clk sync to!event(); else i (time over(to ev queue!irst!time)) to ev queue!irst!new event(); to ev queue!dequeue(); else done =1; while(!done); The event loop is implemented in a standard way usin the Unix select() system call: the receive events are reistered in the d set readds usin the FD SET unction call and the earliest timeout event is included in the timeval struct to. A queue to ev queue o timeout events is maintained that stores all timeout events reistered. This queue is sorted by the time the timeout events are suppose to occur. Because timely processin o timeout events is important, a timeout event is processed beore a messaereceipt event. To ensure that a clock synchronization timeout event is iven priority over any other timeout event, a separate variable clk sync to is maintained to record when the next clock synchronization timeout event will occur. Ater processin the irst timeout event, i the clock synchronization timeout event has occurred, it is processed. 5. Evaluation 5.1. Complexity o Implementation Concurrent events raise two related prorammin problems that need to be addressed: race conditions and schedulin. Concurrent events can cause race conditions in a thread-based implementation, and so, appropriate synchronization primitives have to be used. This adds complexity in the code. In eneral, concurrent prorammin is hard and extra attention has to be paid to ensure correctness. Because not all threads have equal priority in a threadbased implementation, a runnin thread may be preempted in the middle o a unction execution. To ensure that all threads et a air share o the CPU, they have to explicitly yield the CPU control at some loical points in their execution. Hence, the schedulin o the threads has to be controlled, to some extent, by implementors in a thread-based implementation. Since, there is only one thread o control in an eventbased implementation, the problems o race conditions or schedulin do not arise. However, in an event-based implementation, an event loop has to be implemented that schedules the processin o events in an appropriate order. Special care has to be taken in the implementation o this event loop to ensure that hiher priority events, such as the timeout event in the clock synchronization protocol, are processed irst. We ound that an event-based implementation resulted in a simpler and more manaeable code. Usin synchronization primitives correctly and controllin the schedulin o threads in the thread-based implementation was much more complicated than implementin the event loop in the eventbased implementation Portability A thread-based implementation needs a threads packae, either implemented inside the operatin system kernel or at the user level, while an event-based implementation needs a system call such as select() to examine an I/O descriptor set or event schedulin. Our experience in implementin roup communication services has been mostly on a Unix platorm. While the select() system call is portable amon all types o Unix operatin system, a threads packae is not always portable. For example, we implemented the Pinwheel atomic broadcast protocols on a network o Sun IPX SPARCstations runnin SunOS Unix operatin system [3]. This implementation used the Sun s LWP thread manaement library that runs on SunOS Unortunately, this thread manaement library does not run on other Unix operatin systems such as Solaris or IRIX. As a result, we had to do a lot o work to run the Pinwheel protocols on an IRIX operatin system platorm. So, while an event-based implementation is airly portable, the portability o a thread-based implementation is limited by the portability o the threads packae used. In the past, when no standardized threads packaes existed, this was a major problem. However, with standard threads packaes such POSIX-compliant pthreads becomin more common, this portability problem with a thread-based implementation is expected to diminish Perormance There are our perormance indices we have measured: throuhput, averae broadcast delivery time, averae broadcast stability time, and averae number o messaes exchaned per atomic broadcast. Throuhput measured rom the event-based implementation is hiher than the throuhput measured rom the threadbased implementation or all atomicity and order semantics (See Fiures 1, 2, and 3). The dierence in the throuhput between the two implementations increases with increase in update arrival rate until a saturation point is reached. We measured averae delivery times or our dierent update interarrival times. The averae delivery time measured rom the event-based implementation is smaller than

4 25 25 WeakTime_event WeakTime_thread StronNO_event StronNO_thread # Updates Arrivin per Second # Updates Arrivin per Second Fiure 1. Throuhput (Wk atm/tm ord). Fiure 3. Throuhput (Strc atm/no ord) StronTotal_event StronTotal_thread # Updates Arrivin per Second Fiure 2. Throuhput (Strn atm/ttl ord). Interarrival Time Event-based Wk atm/ttl ord Strn atm/tm ord Strc atm/no ord Strc atm/ttl ord Thread-based Wk atm/ttl ord Strn atm/tm ord Strc atm/no ord Strc atm/ttl ord Table 1. Delivery time (msec) the averae delivery time measured rom the thread-based implementation or all atomicity and order semantics or all our update interarrival times (See Table 1). Similarly, the averae stability time measured rom the event-based implementation is smaller than the averae stability time measured rom the thread-based implementation or all atomicity and order semantics or all our update interarrival times(see Table 2). Finally, the averae number o messaes exchaned per atomic broadcast is slihtly hiher in the event-based implementation than in the thread-based implementation (See Table 3). The perormance o the event-based implementation is almost always better than the thread-based implementation, except in case o number o messaes exchaned. There are two sources o perormance overhead in the thread-based implementation that are not present in the event-based implementation: context switchin times between threads durin schedulin and the execution time o synchronization primitives. On the other hand, there is one source o peror- mance overhead in the event-based implementation that is not present in the thread-based implementation: the execution time o the select() system call. An event occurrence results in a sinle execution o pthread mutex lock();pthread mutex unlock(); and at least one thread context switch in the threadbased implementation. An event occurrence results in the execution o zero or one select() system call in the event-based implementation. The thread context switchin time is about 16 microseconds (averaed over 1, pthread yield() operations). The execution time o pthread mutex lock(); pthread mutex unlock(); is about 14 microseconds (averaed over the execution o 1, such pairs). The execution time o the select() system call is extremely small (less than 5 micro seconds). These measurements clearly show that the perormance overhead due to the execution o the select() system call is ar less than the perormance overhead due to the execution o pthread mutex lock();

5 Interarrival Time Event-based Wk atm/no ord Wk atm/ttl ord Strn atm/tm ord Strc atm/no ord Thread-based Wk atm/no ord Wk atm/ttl ord Strn atm/tm ord Strc atm/no ord Table 2. Stability time (msec) Interarrival Time Event-based Thread-based Table 3. # o messaes, (Wk atm/no ord) pthread mutex unlock(); and one thread context switch. Perhaps, the dierence in the perormance between the two implementations can be reduced by a much more eicient implementation o a pthreads library. However, we believe that there are some undamental overheads in the thread-based implementation that can t be avoided, and the perormance o an event-based implementation o a roup communication service is always expected to be better. service, such as low control or establishin messae stability. Perhaps, addin/removin eatures in an experimental system is simpler with threads than with events. Reerences [1] Y. Amir, L. Moser, P. Melliar-Smith, D. Aarwal, and P. Ciarella. The totem sinle-rin orderin and membership protocol. ACM TOCS, 13(4): , [2] K. Birman, A. Schiper, and P. Stephenson. Lihtweiht causal and atomic roup multicast. ACM TOCS, 9(3): , Au [3] F. Cristian, S. Mishra, and G. Alvarez. Hih-perormance asynchronous atomic broadcast. Distributed Systems Enineerin, 4(2):19 128, Jun [4] C. Fetzer and F. Cristian. Fail-awareness in timed asynchronous systems. In 15th ACM PODC, Philadelphia, PA, May [5] S. Mishra, C. Fetzer, and F. Cristian. The timewheel asynchronous atomic broadcast protocol. In 1997 PDPTA, paes , Las Veas, NV, Jun [6] S. Mishra, C. Fetzer, and F. Cristian. The timewheel roup membership protocol. In Proceedins o the Workshop on Fault Tolerant Parallel and Distributed Systems, Orlando, FL, Apr [7] S. Mishra, L. Peterson, and R. Schlichtin. Consul: A communication substrate or ault-tolerant distributed prorams. Distributed Systems Enineerin, 1(2):87 13, Dec [8] R. van Renesse, K. Birman, R. Friedman, M. Hayden, and D. Karr. A ramework or protocol composition in horus. In 14th ACM Symposium on Principles o Distributed Computin, Au Conclusion Both the thread-based and the event-based implementation techniques have been used extensively by researchers to implement roup communication services. Our evaluation o these techniques suests that an event-based implementation is preerable to a thread-based implementation. An event-based implementation results in better perormance, simpler, more manaeable, and portable code. It is worth notin that threads have been used in implementin a number o popular roup communication services. There are two reasons that we can think o or the use o threads in implementin these services. First, a threads-based implementation is oten considered a natural way o implementin systems that have concurrent events. This was the main reason why we used threads to implement roup communication services in the past [7, 3]. Second, most o the roup communication systems that use threads are desined to experiment with dierent eatures o a roup communication

U1 S1 T1 U2 S1 T2 U3 S2 T3 U4 S3 T4

U1 S1 T1 U2 S1 T2 U3 S2 T3 U4 S3 T4 A Toolkit of Services for Implementin Fault-Tolerant Distributed Protocols Flaviu Cristian Department of Computer Science & Enineerin University of California, San Dieo La Jolla, CA 92093-0114, U.S.A.

More information

OCC and Its Variants. Jan Lindström. Helsinki 7. November Seminar on real-time systems UNIVERSITY OF HELSINKI. Department of Computer Science

OCC and Its Variants. Jan Lindström. Helsinki 7. November Seminar on real-time systems UNIVERSITY OF HELSINKI. Department of Computer Science OCC and Its Variants Jan Lindström Helsinki 7. November 1997 Seminar on real-time systems UNIVERSITY OF HELSINKI Department o Computer Science Contents 1 Introduction 1 2 Optimistic Concurrency Control

More information

A Cell Burst Scheduling for ATM Networking Part II: Implementation

A Cell Burst Scheduling for ATM Networking Part II: Implementation A Cell Burst Schedulin or ATM Networkin Part II: Implementation C. Tan, A. T. Chronopoulos, Senior Member, IEEE Computer Science Department Wayne State University email:ctan, chronos@cs.wayne.edu E. Yaprak,

More information

Performance and Overhead Measurements. on the Makbilan. Department of Computer Science. The Hebrew University of Jerusalem

Performance and Overhead Measurements. on the Makbilan. Department of Computer Science. The Hebrew University of Jerusalem Perormance and Overhead Measurements on the Makbilan Yosi Ben-Asher Dror G. Feitelson Dtment o Computer Science The Hebrew University o Jerusalem 91904 Jerusalem, Israel E-mail: yosi,dror@cs.huji.ac.il

More information

Status. We ll do code generation first... Outline

Status. We ll do code generation first... Outline Status Run-time Environments Lecture 11 We have covered the ront-end phases Lexical analysis Parsin Semantic analysis Next are the back-end phases Optimization Code eneration We ll do code eneration irst...

More information

Integrated QOS management for disk I/O. Dept. of Comp. Sci. Dept. of Elec. Engg. 214 Zachry. College Station, TX

Integrated QOS management for disk I/O. Dept. of Comp. Sci. Dept. of Elec. Engg. 214 Zachry. College Station, TX Interated QOS manaement or disk I/O Ravi Wijayaratne A. L. Narasimha Reddy Dept. o Comp. Sci. Dept. o Elec. En. Texas A & M University 214 Zachry Collee Station, TX 77843-3128 ravi,reddy@ee.tamu.edu Abstract

More information

An Internet Collaborative Environment for Sharing Java Applications

An Internet Collaborative Environment for Sharing Java Applications An Internet Collaborative Environment for Sharin Java Applications H. Abdel-Wahab and B. Kvande Department of Computer Science Old Dominion University Norfolk, Va 23529 fwahab,kvande@cs.odu.edu O. Kim

More information

A SUIF Interface Module for Eli. W. M. Waite. University of Colorado

A SUIF Interface Module for Eli. W. M. Waite. University of Colorado A SUIF Interace Module or Eli W. M. Waite Department o Electrical and Computer Enineerin University o Colorado William.Waite@Colorado.edu 1 What is Eli? Eli [2] is a domain-specic prorammin environment

More information

Supporting Preemptive User-Level Threads for Embedded Real-Time Systems

Supporting Preemptive User-Level Threads for Embedded Real-Time Systems Technical Report No. SNU-EE-TR-1998-1 Supportin Preemptive User-Level Threads for Embedded Real-Time Systems Yanmin Seo Junkeun Park Seonsoo Hon Auust 1998 School of Electrical Enineerin Seoul National

More information

Asynchronous Events on Linux

Asynchronous Events on Linux Asynchronous Events on Linux Frederic.Rossi@Ericsson.CA Open System Lab Systems Research June 25, 2002 Ericsson Research Canada Introduction Linux performs well as a general purpose OS but doesn t satisfy

More information

COS 318: Midterm Exam (October 23, 2012) (80 Minutes)

COS 318: Midterm Exam (October 23, 2012) (80 Minutes) COS 318: Midterm Exam (October 23, 2012) (80 Minutes) Name: This exam is closed-book, closed-notes. 1 single-sided 8.5x11 sheet of notes is permitted. No calculators, laptop, palmtop computers are allowed

More information

Packing Messages as a Tool for Boosting the Performance of. Roy Friedman Robbert van Renesse. Cornell University. Abstract

Packing Messages as a Tool for Boosting the Performance of. Roy Friedman Robbert van Renesse. Cornell University. Abstract Packing Messages as a Tool for Boosting the Performance of Total Ordering Protocols Roy Friedman Robbert van Renesse Department of Computer Science Cornell University Ithaca, NY 14853. July 7, 1995 Abstract

More information

Process Synchronization with Readers and Writers Revisited

Process Synchronization with Readers and Writers Revisited Journal of Computin and Information Technoloy - CIT 13, 2005, 1, 43 51 43 Process Synchronization with Readers and Writers Revisited Jalal Kawash Department of Computer Science, American University of

More information

Real Time Operating Systems and Middleware

Real Time Operating Systems and Middleware Real Time Operating Systems and Middleware POSIX Threads Synchronization Luca Abeni abeni@dit.unitn.it Real Time Operating Systems and Middleware p. 1 Threads Synchronisation All the threads running in

More information

Efficient Sleep/Wake-up Protocols for User-Level IPC

Efficient Sleep/Wake-up Protocols for User-Level IPC Efficient Sleep/Wake-up Protocols for User-Level IPC Ronald C. Unrau Department of Computin Science University of Alberta, CANADA unrau@cs.ualberta.ca Orran Krieer IBM T.J. Watson Research Centre Yorktown

More information

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

CSE Traditional Operating Systems deal with typical system software designed to be: CSE 6431 Traditional Operating Systems deal with typical system software designed to be: general purpose running on single processor machines Advanced Operating Systems are designed for either a special

More information

Real-Time Programming with GNAT: Specialised Kernels versus POSIX Threads

Real-Time Programming with GNAT: Specialised Kernels versus POSIX Threads Real-Time Programming with GNAT: Specialised Kernels versus POSIX Threads Juan A. de la Puente 1, José F. Ruiz 1, and Jesús M. González-Barahona 2, 1 Universidad Politécnica de Madrid 2 Universidad Carlos

More information

Coarse Grained Parallel Maximum Matching In Convex Bipartite Graphs

Coarse Grained Parallel Maximum Matching In Convex Bipartite Graphs Coarse Grained Parallel Maximum Matchin In Convex Bipartite Graphs P. Bose, A. Chan, F. Dehne, and M. Latzel School o Computer Science Carleton University Ottawa, Canada K1S 5B6 jit,achan,dehne,mlatzel@scs.carleton.ca

More information

CSE 4/521 Introduction to Operating Systems

CSE 4/521 Introduction to Operating Systems CSE 4/521 Introduction to Operating Systems Lecture 7 Process Synchronization II (Classic Problems of Synchronization, Synchronization Examples) Summer 2018 Overview Objective: 1. To examine several classical

More information

C09: Process Synchronization

C09: 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 information

MetaTeD A Meta Language for Modeling. Telecommunication Networks. Kalyan S. Perumalla and Richard M. Fujimoto

MetaTeD A Meta Language for Modeling. Telecommunication Networks. Kalyan S. Perumalla and Richard M. Fujimoto MetaTeD A Meta Lanuae or Modelin Telecommunication Networks Kalyan S. Perumalla and Richard M. Fujimoto (kalyan@cc.atech.edu and ujimoto@cc.atech.edu) Collee o Computin Georia Institute o Technoloy Atlanta,

More information

Using Real-Time Serializability and Optimistic Concurrency Control in Firm Real-Time Databases

Using Real-Time Serializability and Optimistic Concurrency Control in Firm Real-Time Databases Usin Real-Time Serializability and Optimistic Concurrency Control in Firm Real-Time Databases Jan Lindström and Kimmo Raatikainen University o Helsinki, Department o Computer Science P.O. Box 26 (Teollisuuskatu

More information

Image Fusion for Enhanced Vision System using Laplacian Pyramid

Image Fusion for Enhanced Vision System using Laplacian Pyramid Imae Fusion or Enhanced Vision System usin aplacian Pyramid Abhilash G, T.V. Rama Murthy Department o ECE REVA Institute o Technoloy and Manaement Banalore-64, India V. P. S Naidu MSDF ab, FMCD, CSIR-National

More information

Definition Multithreading Models Threading Issues Pthreads (Unix)

Definition Multithreading Models Threading Issues Pthreads (Unix) Chapter 4: Threads Definition Multithreading Models Threading Issues Pthreads (Unix) Solaris 2 Threads Windows 2000 Threads Linux Threads Java Threads 1 Thread A Unix process (heavy-weight process HWP)

More information

Intro to Threads. Two approaches to concurrency. Threaded multifinger: - Asynchronous I/O (lab) - Threads (today s lecture)

Intro to Threads. Two approaches to concurrency. Threaded multifinger: - Asynchronous I/O (lab) - Threads (today s lecture) Intro to Threads Two approaches to concurrency - Asynchronous I/O (lab) - Threads (today s lecture) Threaded multifinger: - Run many copies of finger simultaneously for (int i = 1; i < argc; i++) thread_create

More information

HCE: A New Channel Exchange Scheme for Handovers in Mobile Cellular Systems

HCE: A New Channel Exchange Scheme for Handovers in Mobile Cellular Systems 129 HCE: A New Channel Exchane Scheme for Handovers in Mobile Cellular Systems DNESH K. ANVEKAR* and S. SANDEEP PRADHAN Department of Electrical Communication Enineerin ndian nstitute of Science, Banalore

More information

Concept of a process

Concept of a process Concept of a process In the context of this course a process is a program whose execution is in progress States of a process: running, ready, blocked Submit Ready Running Completion Blocked Concurrent

More information

Operating Systems Comprehensive Exam. There are five questions on this exam. Please answer any four questions total

Operating Systems Comprehensive Exam. There are five questions on this exam. Please answer any four questions total Operating Systems Comprehensive Exam There are five questions on this exam. Please answer any four questions. ID 1 2 3 4 5 total 1) The following questions pertain to McKusick et al's A Fast File System

More information

Multiprocessor and Real- Time Scheduling. Chapter 10

Multiprocessor and Real- Time Scheduling. Chapter 10 Multiprocessor and Real- Time Scheduling Chapter 10 Classifications of Multiprocessor Loosely coupled multiprocessor each processor has its own memory and I/O channels Functionally specialized processors

More information

Overview. Thread Packages. Threads The Thread Model (1) The Thread Model (2) The Thread Model (3) Thread Usage (1)

Overview. Thread Packages. Threads The Thread Model (1) The Thread Model (2) The Thread Model (3) Thread Usage (1) Overview Thread Packages Thomas Plagemann With slides from O. Anshus, C. Griwodz, M. van Steen, and A. Tanenbaum What are threads? Why threads? Example: Da CaPo 1.0 Thread implementation User level level

More information

Sistemi in Tempo Reale

Sistemi in Tempo Reale Laurea Specialistica in Ingegneria dell'automazione Sistemi in Tempo Reale Giuseppe Lipari Introduzione alla concorrenza Fundamentals Algorithm: It is the logical procedure to solve a certain problem It

More information

Chapter 6 Process Synchronization

Chapter 6 Process Synchronization Chapter 6 Process Synchronization Cooperating Process process that can affect or be affected by other processes directly share a logical address space (threads) be allowed to share data via files or messages

More information

Microkernel/OS and Real-Time Scheduling

Microkernel/OS and Real-Time Scheduling Chapter 12 Microkernel/OS and Real-Time Scheduling Hongwei Zhang http://www.cs.wayne.edu/~hzhang/ Ack.: this lecture is prepared in part based on slides of Lee, Sangiovanni-Vincentelli, Seshia. Outline

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

Chapter 4: Threads. Overview Multithreading Models Thread Libraries Threading Issues Operating System Examples Windows XP Threads Linux Threads

Chapter 4: Threads. Overview Multithreading Models Thread Libraries Threading Issues Operating System Examples Windows XP Threads Linux Threads Chapter 4: Threads Overview Multithreading Models Thread Libraries Threading Issues Operating System Examples Windows XP Threads Linux Threads Chapter 4: Threads Objectives To introduce the notion of a

More information

Resource Access Control (2) Real-Time and Embedded Systems (M) Lecture 14

Resource Access Control (2) Real-Time and Embedded Systems (M) Lecture 14 Resource Access Control (2) Real-Time and Embedded Systems (M) Lecture 14 Lecture Outline Resources access control (cont d): Enhancing the priority ceiling protocol Stack-based priority ceiling protocol

More information

Threads. CS3026 Operating Systems Lecture 06

Threads. CS3026 Operating Systems Lecture 06 Threads CS3026 Operating Systems Lecture 06 Multithreading Multithreading is the ability of an operating system to support multiple threads of execution within a single process Processes have at least

More information

Timers 1 / 46. Jiffies. Potent and Evil Magic

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

1 Introduction. 2 Managing contexts. Green, green threads of home. Johan Montelius HT2018

1 Introduction. 2 Managing contexts. Green, green threads of home. Johan Montelius HT2018 1 Introduction Green, green threads of home Johan Montelius HT2018 This is an assignment where you will implement your own thread library. Instead of using the operating systems threads you will create

More information

Chapter 4: Multithreaded Programming. Operating System Concepts 8 th Edition,

Chapter 4: Multithreaded Programming. Operating System Concepts 8 th Edition, Chapter 4: Multithreaded Programming, Silberschatz, Galvin and Gagne 2009 Chapter 4: Multithreaded Programming Overview Multithreading Models Thread Libraries Threading Issues 4.2 Silberschatz, Galvin

More information

Threads. What is a thread? Motivation. Single and Multithreaded Processes. Benefits

Threads. What is a thread? Motivation. Single and Multithreaded Processes. Benefits CS307 What is a thread? Threads A thread is a basic unit of CPU utilization contains a thread ID, a program counter, a register set, and a stack shares with other threads belonging to the same process

More information

Chapter 4: Multi-Threaded Programming

Chapter 4: Multi-Threaded Programming Chapter 4: Multi-Threaded Programming Chapter 4: Threads 4.1 Overview 4.2 Multicore Programming 4.3 Multithreading Models 4.4 Thread Libraries Pthreads Win32 Threads Java Threads 4.5 Implicit Threading

More information

High Performance Computing Course Notes Shared Memory Parallel Programming

High Performance Computing Course Notes Shared Memory Parallel Programming High Performance Computing Course Notes 2009-2010 2010 Shared Memory Parallel Programming Techniques Multiprocessing User space multithreading Operating system-supported (or kernel) multithreading Distributed

More information

CSEN 602-Operating Systems, Spring 2018 Practice Assignment 2 Solutions Discussion:

CSEN 602-Operating Systems, Spring 2018 Practice Assignment 2 Solutions Discussion: CSEN 602-Operating Systems, Spring 2018 Practice Assignment 2 Solutions Discussion: 10.2.2018-15.2.2018 Exercise 2-1: Reading Read sections 2.1 (except 2.1.7), 2.2.1 till 2.2.5. 1 Exercise 2-2 In Fig.1,

More information

Introduction to Embedded Systems

Introduction to Embedded Systems Introduction to Embedded Systems Sanjit A. Seshia UC Berkeley EECS 9/9A Fall 0 008-0: E. A. Lee, A. L. Sangiovanni-Vincentelli, S. A. Seshia. All rights reserved. Chapter : Operating Systems, Microkernels,

More information

Systèmes d Exploitation Avancés

Systè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 information

RE2C { A More Versatile Scanner Generator. Peter Bumbulis Donald D. Cowan. University of Waterloo. April 15, Abstract

RE2C { A More Versatile Scanner Generator. Peter Bumbulis Donald D. Cowan. University of Waterloo. April 15, Abstract RE2C { A More Versatile Scanner Generator Peter Bumbulis Donald D. Cowan Computer Science Department and Computer Systems Group University o Waterloo April 15, 1994 Abstract It is usually claimed that

More information

Chapter 5: Process Synchronization. Operating System Concepts 9 th Edition

Chapter 5: Process Synchronization. Operating System Concepts 9 th Edition Chapter 5: Process Synchronization Silberschatz, Galvin and Gagne 2013 Chapter 5: Process Synchronization Background The Critical-Section Problem Peterson s Solution Synchronization Hardware Mutex Locks

More information

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

CISC2200 Threads Spring 2015

CISC2200 Threads Spring 2015 CISC2200 Threads Spring 2015 Process We learn the concept of process A program in execution A process owns some resources A process executes a program => execution state, PC, We learn that bash creates

More information

Concurrency, Mutual Exclusion and Synchronization C H A P T E R 5

Concurrency, Mutual Exclusion and Synchronization C H A P T E R 5 Concurrency, Mutual Exclusion and Synchronization C H A P T E R 5 Multiple Processes OS design is concerned with the management of processes and threads: Multiprogramming Multiprocessing Distributed processing

More information

operating system Spring 2017 Prof.Dr. Hasan Balik Student Name : Walid.W. Ramadan mansour Student ID :

operating system Spring 2017 Prof.Dr. Hasan Balik Student Name : Walid.W. Ramadan mansour Student ID : operating system Spring 2017 Prof.Dr. Hasan Balik Student Name : Walid.W. Ramadan mansour Student ID : 163110469 Email : wild.mansour526@gmail.com Unix SVR4 (OpenSolaris and illumos distributions) Process

More information

Mutex Implementation

Mutex Implementation COS 318: Operating Systems Mutex Implementation Jaswinder Pal Singh Computer Science Department Princeton University (http://www.cs.princeton.edu/courses/cos318/) Revisit Mutual Exclusion (Mutex) u Critical

More information

Processes and Non-Preemptive Scheduling. Otto J. Anshus

Processes and Non-Preemptive Scheduling. Otto J. Anshus Processes and Non-Preemptive Scheduling Otto J. Anshus Threads Processes Processes Kernel An aside on concurrency Timing and sequence of events are key concurrency issues We will study classical OS concurrency

More information

Process Scheduling Queues

Process Scheduling Queues Process Control Process Scheduling Queues Job queue set of all processes in the system. Ready queue set of all processes residing in main memory, ready and waiting to execute. Device queues set of processes

More information

Chapter 4: Threads. Chapter 4: Threads. Overview Multicore Programming Multithreading Models Thread Libraries Implicit Threading Threading Issues

Chapter 4: Threads. Chapter 4: Threads. Overview Multicore Programming Multithreading Models Thread Libraries Implicit Threading Threading Issues Chapter 4: Threads Silberschatz, Galvin and Gagne 2013 Chapter 4: Threads Overview Multicore Programming Multithreading Models Thread Libraries Implicit Threading Threading Issues 4.2 Silberschatz, Galvin

More information

Chapter 4: Threads. Operating System Concepts 9 th Edition

Chapter 4: Threads. Operating System Concepts 9 th Edition Chapter 4: Threads Silberschatz, Galvin and Gagne 2013 Chapter 4: Threads Overview Multicore Programming Multithreading Models Thread Libraries Implicit Threading Threading Issues Operating System Examples

More information

A Predictable RTOS. Mantis Cheng Department of Computer Science University of Victoria

A Predictable RTOS. Mantis Cheng Department of Computer Science University of Victoria A Predictable RTOS Mantis Cheng Department of Computer Science University of Victoria Outline I. Analysis of Timeliness Requirements II. Analysis of IO Requirements III. Time in Scheduling IV. IO in Scheduling

More information

Copyright 2013 Thomas W. Doeppner. IX 1

Copyright 2013 Thomas W. Doeppner. IX 1 Copyright 2013 Thomas W. Doeppner. IX 1 If we have only one thread, then, no matter how many processors we have, we can do only one thing at a time. Thus multiple threads allow us to multiplex the handling

More information

The SpecC Methodoloy Technical Report ICS December 29, 1999 Daniel D. Gajski Jianwen Zhu Rainer Doemer Andreas Gerstlauer Shuqin Zhao Department

The SpecC Methodoloy Technical Report ICS December 29, 1999 Daniel D. Gajski Jianwen Zhu Rainer Doemer Andreas Gerstlauer Shuqin Zhao Department The SpecC Methodoloy Technical Report ICS-99-56 December 29, 1999 Daniel D. Gajski Jianwen Zhu Rainer Doemer Andreas Gerstlauer Shuqin Zhao Department of Information and Computer Science University of

More information

The Totem System. L. E. Moser, P. M. Melliar-Smith, D. A. Agarwal, R. K. Budhia, C. A. Lingley-Papadopoulos, T. P. Archambault

The Totem System. L. E. Moser, P. M. Melliar-Smith, D. A. Agarwal, R. K. Budhia, C. A. Lingley-Papadopoulos, T. P. Archambault The Totem System L. E. Moser, P. M. Melliar-Smith, D. A. Agarwal, R. K. Budhia, C. A. Lingley-Papadopoulos, T. P. Archambault Department of Electrical and Computer Engineering University of California,

More information

Locks and semaphores. Johan Montelius KTH

Locks and semaphores. Johan Montelius KTH Locks and semaphores Johan Montelius KTH 2018 1 / 40 recap, what s the problem : # include < pthread.h> volatile int count = 0; void * hello ( void * arg ) { for ( int i = 0; i < 10; i ++) { count ++;

More information

Chapter 6: Process Synchronization. Operating System Concepts 9 th Edit9on

Chapter 6: Process Synchronization. Operating System Concepts 9 th Edit9on Chapter 6: Process Synchronization Operating System Concepts 9 th Edit9on Silberschatz, Galvin and Gagne 2013 Objectives To present the concept of process synchronization. To introduce the critical-section

More information

CS533 Concepts of Operating Systems. Jonathan Walpole

CS533 Concepts of Operating Systems. Jonathan Walpole CS533 Concepts of Operating Systems Jonathan Walpole Introduction to Threads and Concurrency Why is Concurrency Important? Why study threads and concurrent programming in an OS class? What is a thread?

More information

Chapter 5: Synchronization 1

Chapter 5: Synchronization 1 1 Start of Lecture: January 25, 2014 2 Reminders Assignment 1 is due this Friday at 6:00 p.m. Couple comments about Exercise 1: Thought questions: be honest and sincere about questions you have while reading;

More information

PROCESSES AND THREADS THREADING MODELS. CS124 Operating Systems Winter , Lecture 8

PROCESSES AND THREADS THREADING MODELS. CS124 Operating Systems Winter , Lecture 8 PROCESSES AND THREADS THREADING MODELS CS124 Operating Systems Winter 2016-2017, Lecture 8 2 Processes and Threads As previously described, processes have one sequential thread of execution Increasingly,

More information

Problem Set 2. CS347: Operating Systems

Problem Set 2. CS347: Operating Systems CS347: Operating Systems Problem Set 2 1. Consider a clinic with one doctor and a very large waiting room (of infinite capacity). Any patient entering the clinic will wait in the waiting room until the

More information

CS 333 Introduction to Operating Systems. Class 3 Threads & Concurrency. Jonathan Walpole Computer Science Portland State University

CS 333 Introduction to Operating Systems. Class 3 Threads & Concurrency. Jonathan Walpole Computer Science Portland State University CS 333 Introduction to Operating Systems Class 3 Threads & Concurrency Jonathan Walpole Computer Science Portland State University 1 Process creation in UNIX All processes have a unique process id getpid(),

More information

Chapter 3 Process Description and Control

Chapter 3 Process Description and Control Operating Systems: Internals and Design Principles Chapter 3 Process Description and Control Seventh Edition By William Stallings Process Control Block Structure of Process Images in Virtual Memory How

More information

Exam in Real-Time Systems

Exam in Real-Time Systems Exam in Real-Time Systems Course code: D0003E Time: 4 hours, 9:00-13:00 Number of assignments: 7 Total number of points: 31 Date of exam: 2010-08-21 Teacher: Allowed aiding equipment: Fredrik Bengtsson,

More information

Signals, Synchronization. CSCI 3753 Operating Systems Spring 2005 Prof. Rick Han

Signals, Synchronization. CSCI 3753 Operating Systems Spring 2005 Prof. Rick Han , Synchronization CSCI 3753 Operating Systems Spring 2005 Prof. Rick Han Announcements Program Assignment #1 due Tuesday Feb. 15 at 11:55 pm TA will explain parts b-d in recitation Read chapters 7 and

More information

On the interconnection of message passing systems

On the interconnection of message passing systems Information Processing Letters 105 (2008) 249 254 www.elsevier.com/locate/ipl On the interconnection of message passing systems A. Álvarez a,s.arévalo b, V. Cholvi c,, A. Fernández b,e.jiménez a a Polytechnic

More information

CS370 Operating Systems

CS370 Operating Systems CS370 Operating Systems Colorado State University Yashwant K Malaiya Spring 2018 Lecture 8 Threads and Scheduling Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 FAQ How many threads

More information

Chapter 4: Threads. Chapter 4: Threads

Chapter 4: Threads. Chapter 4: Threads Chapter 4: Threads Silberschatz, Galvin and Gagne 2013 Chapter 4: Threads Overview Multicore Programming Multithreading Models Thread Libraries Implicit Threading Threading Issues Operating System Examples

More information

Verifying Concurrent Programs

Verifying Concurrent Programs Verifying Concurrent Programs Daniel Kroening 8 May 1 June 01 Outline Shared-Variable Concurrency Predicate Abstraction for Concurrent Programs Boolean Programs with Bounded Replication Boolean Programs

More information

Suggested Solutions (Midterm Exam October 27, 2005)

Suggested Solutions (Midterm Exam October 27, 2005) Suggested Solutions (Midterm Exam October 27, 2005) 1 Short Questions (4 points) Answer the following questions (True or False). Use exactly one sentence to describe why you choose your answer. Without

More information

Chapter 4: Multithreaded Programming

Chapter 4: Multithreaded Programming Chapter 4: Multithreaded Programming Silberschatz, Galvin and Gagne 2013! Chapter 4: Multithreaded Programming Overview Multicore Programming Multithreading Models Threading Issues Operating System Examples

More information

recap, what s the problem Locks and semaphores Total Store Order Peterson s algorithm Johan Montelius 0 0 a = 1 b = 1 read b read a

recap, what s the problem Locks and semaphores Total Store Order Peterson s algorithm Johan Montelius 0 0 a = 1 b = 1 read b read a recap, what s the problem Locks and semaphores Johan Montelius KTH 2017 # include < pthread.h> volatile int count = 0; void * hello ( void * arg ) { for ( int i = 0; i < 10; i ++) { count ++; int main

More information

Multiprocessors 2007/2008

Multiprocessors 2007/2008 Multiprocessors 2007/2008 Abstractions of parallel machines Johan Lukkien 1 Overview Problem context Abstraction Operating system support Language / middleware support 2 Parallel processing Scope: several

More information

Today s Topics. u Thread implementation. l Non-preemptive versus preemptive threads. l Kernel vs. user threads

Today s Topics. u Thread implementation. l Non-preemptive versus preemptive threads. l Kernel vs. user threads Today s Topics COS 318: Operating Systems Implementing Threads u Thread implementation l Non-preemptive versus preemptive threads l Kernel vs. user threads Jaswinder Pal Singh and a Fabulous Course Staff

More information

Consul: A Communication Substrate for Fault-Tolerant Distributed Programs

Consul: A Communication Substrate for Fault-Tolerant Distributed Programs Consul: A Communication Substrate for Fault-Tolerant Distributed Programs Shivakant Mishra, Larry L. Peterson, and Richard D. Schlichting Department of Computer Science The University of Arizona Tucson,

More information

Lesson 6: Process Synchronization

Lesson 6: Process Synchronization Lesson 6: Process Synchronization Chapter 5: Process Synchronization Background The Critical-Section Problem Peterson s Solution Synchronization Hardware Mutex Locks Semaphores Classic Problems of Synchronization

More information

Communication Networks ( ) / Spring 2011 The Blavatnik School of Computer Science, Tel-Aviv University

Communication Networks ( ) / Spring 2011 The Blavatnik School of Computer Science, Tel-Aviv University ommunication Networks (0368-3030) / Sprin 0 The lavatnik School o omputer Science, Tel-viv University llon Waner urose & Ross, hapters 5.5-5.6 (5 th ed.) Tanenbaum & Wetherall, hapters 4.3.4 4.3.8 (5 th

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

IT 540 Operating Systems ECE519 Advanced Operating Systems

IT 540 Operating Systems ECE519 Advanced Operating Systems IT 540 Operating Systems ECE519 Advanced Operating Systems Prof. Dr. Hasan Hüseyin BALIK (5 th Week) (Advanced) Operating Systems 5. Concurrency: Mutual Exclusion and Synchronization 5. Outline Principles

More information

Native POSIX Thread Library (NPTL) CSE 506 Don Porter

Native POSIX Thread Library (NPTL) CSE 506 Don Porter Native POSIX Thread Library (NPTL) CSE 506 Don Porter Logical Diagram Binary Memory Threads Formats Allocators Today s Lecture Scheduling System Calls threads RCU File System Networking Sync User Kernel

More information

Interrupts and Time. Interrupts. Content. Real-Time Systems, Lecture 5. External Communication. Interrupts. Interrupts

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

CS 571 Operating Systems. Midterm Review. Angelos Stavrou, George Mason University

CS 571 Operating Systems. Midterm Review. Angelos Stavrou, George Mason University CS 571 Operating Systems Midterm Review Angelos Stavrou, George Mason University Class Midterm: Grading 2 Grading Midterm: 25% Theory Part 60% (1h 30m) Programming Part 40% (1h) Theory Part (Closed Books):

More information

Programming with Object Groups in PHOENIX

Programming with Object Groups in PHOENIX Programming with Object Groups in PHOENIX Pascal Felber Rachid Guerraoui Département d Informatique Ecole Polytechnique Fédérale de Lausanne CH-1015 Lausanne, Switzerland felber@lse.epfl.ch rachid@lse.epfl.ch

More information

Threads and Synchronization. Kevin Webb Swarthmore College February 15, 2018

Threads and Synchronization. Kevin Webb Swarthmore College February 15, 2018 Threads and Synchronization Kevin Webb Swarthmore College February 15, 2018 Today s Goals Extend processes to allow for multiple execution contexts (threads) Benefits and challenges of concurrency Race

More information

Centrum voor Wiskunde en Informatica REPORTRAPPORT. Manifold Version 1.0 Programming: Programs and Problems

Centrum voor Wiskunde en Informatica REPORTRAPPORT. Manifold Version 1.0 Programming: Programs and Problems Centrum voor Wiskunde en Inormatica REPORTRAPPORT Maniold Version 1.0 Prorammin: Prorams and Problems C.L. Blom Computer ScienceDepartment o Interactive Systems CS-R9334 1993 Centrum voor Wiskunde en

More information

Chapter 4: Threads. Operating System Concepts 9 th Edition

Chapter 4: Threads. Operating System Concepts 9 th Edition Chapter 4: Threads Silberschatz, Galvin and Gagne 2013 Chapter 4: Threads Overview Multicore Programming Multithreading Models Thread Libraries Implicit Threading Threading Issues Operating System Examples

More information

A Flexible Generator Architecture for Improving Software Dependability

A Flexible Generator Architecture for Improving Software Dependability A Flexible Generator Architecture for Improvin Software Dependability Christof FETZER, Zhen XIAO AT&T Labs - Research 180 Park Avenue Florham Park, NJ 07932 fchristof, xiao@research.att.com Abstract Improvin

More information

POSIX Threads: a first step toward parallel programming. George Bosilca

POSIX Threads: a first step toward parallel programming. George Bosilca POSIX Threads: a first step toward parallel programming George Bosilca bosilca@icl.utk.edu Process vs. Thread A process is a collection of virtual memory space, code, data, and system resources. A thread

More information

Basic vs. Reliable Multicast

Basic vs. Reliable Multicast Basic vs. Reliable Multicast Basic multicast does not consider process crashes. Reliable multicast does. So far, we considered the basic versions of ordered multicasts. What about the reliable versions?

More information

Interrupts, Etc. Operating Systems In Depth V 1 Copyright 2018 Thomas W. Doeppner. All rights reserved.

Interrupts, Etc. Operating Systems In Depth V 1 Copyright 2018 Thomas W. Doeppner. All rights reserved. Interrupts, Etc. Operating Systems In Depth V 1 Copyright 2018 Thomas W. Doeppner. All rights reserved. Interrupts User stack frames Kernel stack frames Interrupt handler 1 s frame Interrupt handler 2

More information

Locks. Dongkun Shin, SKKU

Locks. Dongkun Shin, SKKU Locks 1 Locks: The Basic Idea To implement a critical section A lock variable must be declared A lock variable holds the state of the lock Available (unlocked, free) Acquired (locked, held) Exactly one

More information

#prama omp or or( int i=0; i<n; i++ ) process( data[i] ); nodeptr list, p;... Fiure 1: The OpenMP or Prama or( p=list; p!=null; p=p->next ) process(p-

#prama omp or or( int i=0; i<n; i++ ) process( data[i] ); nodeptr list, p;... Fiure 1: The OpenMP or Prama or( p=list; p!=null; p=p->next ) process(p- Flexible Control Structures or Parallelism in OpenMP Sanjiv Shah, Grant Haab, Paul Petersen, & Joe Throop Kuck & Associates, Incorporated 1906 Fox Drive Champain, IL 61820 http://www.kai.com sanjiv,rant,petersen,jthroop@kai.com

More information

CS 333 Introduction to Operating Systems Class 4 Concurrent Programming and Synchronization Primitives

CS 333 Introduction to Operating Systems Class 4 Concurrent Programming and Synchronization Primitives CS 333 Introduction to Operating Systems Class 4 Concurrent Programming and Synchronization Primitives Jonathan Walpole Computer Science Portland State University 1 What does a typical thread API look

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