Evinrude. How to build a Petri Net-Based IDS from Program Sources. MeFoSyLoMa Meeting

Size: px
Start display at page:

Download "Evinrude. How to build a Petri Net-Based IDS from Program Sources. MeFoSyLoMa Meeting"

Transcription

1 MeFoSyLoMa Meeting Jean-Baptiste Voron - LIP6 (UPMC) Fabrice Kordon - LIP6 (UPMC) Liviu Iftode - DiscoLab (Rutgers University) Evinrude How to build a Petri Net-Based IDS from Program Sources December 5th, Version 1.3b

2 Context: Intrusion Detection Computer System (network / program / OS) Signature-based detection (misuse detection) Behavior-based detection (anomaly detection) Looking for deviations from an expected behavior Limitation: parallel and distributed programs 2

3 Context: Intrusion Detection Computer System (network / program / OS) Signature-based detection (misuse detection) Behavior-based detection (anomaly detection) Looking for deviations from an expected behavior Limitation: parallel and distributed programs 2

4 Context: Intrusion Detection Events Computer System (network / program / OS) Events IDS Events Events Signature-based detection (misuse detection) Behavior-based detection (anomaly detection) Looking for deviations from an expected behavior Limitation: parallel and distributed programs 2

5 Context: Intrusion Detection Events Computer System (network / program / OS) Event Events IDS Events Events Signature-based detection (misuse detection) Behavior-based detection (anomaly detection) Looking for deviations from an expected behavior Limitation: parallel and distributed programs 2

6 Context: Intrusion Detection Events Expected Behavior Computer System (network / program / OS) Events IDS Events Events Signature-based detection (misuse detection) Behavior-based detection (anomaly detection) Looking for deviations from an expected behavior Limitation: parallel and distributed programs 2

7 Approach & Choices Build an Intrusion Detection System (IDS) Dedicated to a program & Behavior based Handle large and complex programs C programs (real-life programs) Multi Processes / Multi Threaded programs 1 2 Program Program s Behavior Intrusion Detection System 3

8 Approach & Choices Behavior modeling relies on Petri nets Used as state-space generators Construction process is fully automatic IDS is produced from program sources No formal background required for developers No code instrumentation (neither source nor binary) Hypothesis Operating System is considered healthy 4

9 From programs to models Several steps are required to produce a model Extract (relevant) information Transform it into Petri nets Optimize the net in order to produce the smallest one C CFO Petri net Petri net Offline Analysis inside(...) { if (...) { write; } else { close; } if (unlink) ;; function beaphilo # Block 0 : pred Entry, 2, 3 D = Parser Builder Optimization 5

10 From programs to models Several steps are required to produce a model Extract (relevant) information Transform it into Petri nets Optimize the net in order to produce the smallest one C CFO Petri net Petri net Offline Analysis inside(...) { if (...) { write; } else { close; } if (unlink) ;; function beaphilo # Block 0 : pred Entry, 2, 3 D = Online Analysis Monitor Parser Builder Optimization Code Generation 5

11 Monitoring Philosophers is pretty hard with standard IDS! Multi-threaded version Pthread library calls - Thread Management - Thread Synchronization 6

12 Monitoring Philosophers is pretty hard with standard IDS! Multi-threaded version int main (int argn, char **argv) { pthread_mutex_init(&foodlock,null); Pthread library calls // Forks... for (i = 0; i < PHILO; i++) { pthread_mutex_init(&fork[i],null); pthread_create(&p[i],null,philosopher,null); } - Thread Management - Thread Synchronization for (i = 0; i < PHILO; i++) { pthread_join(p[i],null); } 6

13 Monitoring Philosophers is pretty hard with standard IDS! Multi-threaded version int main (int argn, char **argv) { pthread_mutex_init(&foodlock,null); Pthread library calls // Forks... for (i = 0; i < PHILO; i++) { pthread_mutex_init(&fork[i],null); pthread_create(&p[i],null,philosopher,null); } - Thread Management - Thread Synchronization for (i = 0; i < PHILO; i++) { pthread_join(p[i],null); } void * philosopher () { int f; printf("philo is sitting down to dinner.\n"); while((f = food_on_table())) { pthread_mutex_lock(&fork_left); pthread_mutex_lock(&fork_right); printf("philo is eating.\n"); pthread_mutex_unlock(&fork_right); pthread_mutex_unlock(&fork_left); } printf("philo is done eating.\n"); pthread_exit(null); } 6

14 Monitoring Philosophers is pretty hard with standard IDS! Multi-threaded version int main (int argn, char **argv) { pthread_mutex_init(&foodlock,null); Pthread library calls // Forks... for (i = 0; i < PHILO; i++) { pthread_mutex_init(&fork[i],null); pthread_create(&p[i],null,philosopher,null); } - Thread Management int food_on_table () { static int food = FOOD; int myfood; - Thread Synchronization for (i = 0; i < PHILO; i++) { pthread_join(p[i],null); } void * philosopher () { int f; printf("philo is sitting down to dinner.\n"); while((f = food_on_table())) { pthread_mutex_lock(&fork_left); pthread_mutex_lock(&fork_right); printf("philo is eating.\n"); pthread_mutex_unlock(&fork_right); pthread_mutex_unlock(&fork_left); } printf("philo is done eating.\n"); pthread_exit(null); } pthread_mutex_lock(&foodlock); if (food > 0) { food--; } myfood = food; pthread_mutex_unlock (&foodlock); return myfood; } 6

15 C CFO Parser Builder Optimizer Extracting Information Use of GCC to extract information During the compilation No need to modify the MakeFile (just set ENV variable) Use of Extended Control Flow Graph (ECFG) TU Source Code GCC CFG CFG Parser Control Flow Objects GPL Parser module 7

16 C CFO Parser Builder Optimizer Dealing with Perspectives All extracted information is not relevant for analysis However, structural information is systematically extracted Need a flexible way to analyse source: Perspectives Based on a dictionary of remarkable elements Set of transformations Source Code GCC CFG Parser 8

17 C CFO Parser Builder Optimizer Dealing with Perspectives All extracted information is not relevant for analysis However, structural information is systematically extracted Need a flexible way to analyse source: Perspectives Based on a dictionary of remarkable elements Set of transformations Source Code GCC CFG Parser struct information set St 8

18 C CFO Parser Builder Optimizer Dealing with Perspectives All extracted information is not relevant for analysis However, structural information is systematically extracted Need a flexible way to analyse source: Perspectives Based on a dictionary of remarkable elements Set of transformations Source Code GCC CFG Parser struct information set thread information set St Th Sy syscall information set Perspective s definition (XML) 8

19 C CFO Parser Builder Optimizer Dealing with Perspectives All extracted information is not relevant for analysis However, structural information is systematically extracted Need a flexible way to analyse source: Perspectives Based on a dictionary of remarkable elements Set of transformations Source Code GCC CFG Parser struct information set thread information set Builder St Th Sy syscall information set Perspective s definition (XML) 8

20 C CFO Parser Builder Optimizer Perspectives & Philosophers Perspective s descriptions (XML) St Th Sy Source Code GCC CFG Parser void * philosopher () { int f; printf("philo is sitting down to dinner.\n"); while((f = food_on_table())) { pthread_mutex_lock(&fork_left); pthread_mutex_lock(&fork_right); printf("philo is eating.\n"); pthread_mutex_unlock(&fork_right); pthread_mutex_unlock(&fork_left); } printf("philo is done eating.\n"); pthread_exit(null); } 9

21 C CFO Parser Builder Optimizer Perspectives & Philosophers Perspective s descriptions (XML) GCC St Th Sy CFG Parser Source Code 1. ;; Function philosopher 2. # BLOCK 2 3. # PRED:ENTRY(fallthru) 4. printf(&"philosopher goto <bb 4> (<L1>); 6. # SUCC:4(fallthru) 7. # BLOCK 3 8. # PRED: 4 (true) 9. pthread_mutex_lock(&fork3); 10. pthread_mutex_lock(&fork1); 11. printf(&"philosopher pthread_mutex_unlock(&fork3); 13. pthread_mutex_unlock(&fork1); 14. # SUCC:4(fallthru) 15. # BLOCK # PRED:2(fallthru) 3(fallthru) 17. D.3892 = food_on_table(); 18. f = D.3892; 19. if (f!= 0) goto <L0>; else goto <L2>; 20. # SUCC:3(true) 5(false) 21. # BLOCK # PRED:4(false) 23. printf(&"philosopher pthread_exit (0B); 25. # SUCC:EXIT ECFG 9

22 C CFO Parser Builder Optimizer Perspectives & Philosophers Perspective s descriptions (XML) GCC St Th Sy CFG Parser Struct set Source Code 1. ;; Function philosopher 2. # BLOCK 2 3. # PRED:ENTRY(fallthru) 4. printf(&"philosopher goto <bb 4> (<L1>); 6. # SUCC:4(fallthru) 7. # BLOCK 3 8. # PRED: 4 (true) 9. pthread_mutex_lock(&fork3); 10. pthread_mutex_lock(&fork1); 11. printf(&"philosopher pthread_mutex_unlock(&fork3); 13. pthread_mutex_unlock(&fork1); 14. # SUCC:4(fallthru) 15. # BLOCK # PRED:2(fallthru) 3(fallthru) 17. D.3892 = food_on_table(); 18. f = D.3892; 19. if (f!= 0) goto <L0>; else goto <L2>; 20. # SUCC:3(true) 5(false) 21. # BLOCK # PRED:4(false) 23. printf(&"philosopher pthread_exit (0B); 25. # SUCC:EXIT 9

23 C CFO Parser Builder Optimizer Perspectives & Philosophers Perspective s descriptions (XML) GCC St Th Sy CFG Parser Struct set Thread set Source Code 1. ;; Function philosopher 2. # BLOCK 2 3. # PRED:ENTRY(fallthru) 4. printf(&"philosopher goto <bb 4> (<L1>); 6. # SUCC:4(fallthru) 7. # BLOCK 3 8. # PRED: 4 (true) 9. pthread_mutex_lock(&fork3); 10. pthread_mutex_lock(&fork1); 11. printf(&"philosopher pthread_mutex_unlock(&fork3); 13. pthread_mutex_unlock(&fork1); 14. # SUCC:4(fallthru) 15. # BLOCK # PRED:2(fallthru) 3(fallthru) 17. D.3892 = food_on_table(); 18. f = D.3892; 19. if (f!= 0) goto <L0>; else goto <L2>; 20. # SUCC:3(true) 5(false) 21. # BLOCK # PRED:4(false) 23. printf(&"philosopher pthread_exit (0B); 25. # SUCC:EXIT 9

24 C CFO Parser Builder Optimizer Perspectives & Philosophers Perspective s descriptions (XML) GCC St Th Sy CFG Parser Struct set Thread set Syscall set Builder Source Code 1. ;; Function philosopher 2. # BLOCK 2 3. # PRED:ENTRY(fallthru) 4. printf(&"philosopher goto <bb 4> (<L1>); 6. # SUCC:4(fallthru) 7. # BLOCK 3 8. # PRED: 4 (true) 9. pthread_mutex_lock(&fork3); 10. pthread_mutex_lock(&fork1); 11. printf(&"philosopher pthread_mutex_unlock(&fork3); 13. pthread_mutex_unlock(&fork1); 14. # SUCC:4(fallthru) 15. # BLOCK # PRED:2(fallthru) 3(fallthru) 17. D.3892 = food_on_table(); 18. f = D.3892; 19. if (f!= 0) goto <L0>; else goto <L2>; 20. # SUCC:3(true) 5(false) 21. # BLOCK # PRED:4(false) 23. printf(&"philosopher pthread_exit (0B); 25. # SUCC:EXIT 9

25 C CFO Parser Builder Optimizer Building (small) Petri Nets Production rules : Source to Petri net patterns Each perspective comes with its own production rules - 7 rules to build the structural model - 6 for Thread perspective / 6 for Process Management perspective Each information set is transformed into a Petri net Struct information set gives Structural Model Others give submodels to be plugged to the structural one 10

26 C CFO Parser Builder Optimizer Philos R Nets (still small) Entry Struct Model Exit 11

27 C CFO Parser Builder Optimizer Philos R Nets (still small) 2_1 Entry [printf] 2 3_11 4 [printf] 5 3 5_23 [printf] Exit Syscall Models 11

28 C CFO Parser Builder Optimizer Philos R Nets (still small) 2_1 Entry 3_9 [printf] 2 [v=free] fork_1 <v> <lock> 3_13 3_11 4 fork_1 <v> <free> [printf] 3_ [v=free] fork_3 <v> <lock> 5_23 3_12 <v> fork_3 [printf] Exit <free> Thread Models 11

29 C CFO Parser Builder Optimizer Building (big) Petri Nets Merge all subnets into the structural model Find the right order thanks to the ECFG metadata Traceability of the origin of Petri nets elements Manage all specificities of Petri nets to produce correct nets - Color classes / Color domains - Initial marking One net for each main function Potentially several nets for large applications - When composed of several executables (start / stop / status...) 12

30 One philosopher [printf] 0_Entry 0_Exit 0_4 fork_3 <v> <free> <v> <lock> [v=free] <v> <lock> [v=free] fork_1 <free> <v> CFO C Parser Builder Optimizer [printf] 0_2_1_pre 0_2_1_post struct_0_2_4 struct_0_entry_2 [printf] 0_5_23_pre 0_5_23_post sys_0_5_23_printf sys_0_2_1_printf struct_0_5_exit 0_3_9_pre th_0_3_9_lock th_0_3_10_lock 0_3_10_pre 0_3_11_pre sys_0_3_11_printf 0_3_13_pre th_0_3_13_unlock th_0_3_12_unlock 0_3_12_pre struct_0_3_4 struct_0_4_3 0_3_13_post struct_0_4_5

31 C CFO Parser Builder Optimizer One philosopher... 0_Entry struct_0_entry_2 Use of standard structural reductions 0_3_9_pre 0_2_1_pre sys_0_2_1_printf [printf] th_0_3_9_lock [v=free] 0_3_10_pre <v> <lock> <v> 0_2_1_post 0_3_11_pre [v=free] <lock> 0_5_23_pre struct_0_2_4 0_4 struct_0_4_3 [printf] sys_0_3_11_printf th_0_3_10_lock 0_3_12_pre <v> fork_3 <v> fork_1 sys_0_5_23_printf [printf] 0_5_23_post struct_0_4_5 struct_0_3_4 th_0_3_12_unlock 0_3_13_pre <free> struct_0_5_exit th_0_3_13_unlock <free> 0_Exit 0_3_13_post 13

32 C CFO Parser Builder Optimizer One philosopher... 0_Entry struct_0_entry_2 Use of standard structural reductions 0_3_9_pre 0_2_1_pre sys_0_2_1_printf [printf] th_0_3_9_lock [v=free] 0_3_10_pre <v> <lock> <v> 0_2_1_post 0_3_11_pre [v=free] <lock> 0_5_23_pre struct_0_2_4 0_4 struct_0_4_3 [printf] sys_0_3_11_printf th_0_3_10_lock 0_3_12_pre <v> fork_3 <v> fork_1 sys_0_5_23_printf [printf] 0_5_23_post struct_0_4_5 struct_0_3_4 th_0_3_12_unlock 0_3_13_pre <free> struct_0_5_exit 0_Exit th_0_3_13_unlock <free> 0_3_13_post cannot be optimized cannot be optimized eligible for optimization 13

33 C CFO Parser Builder Optimizer Offline Analysis Some basic properties can be checked before runtime Structural properties Dead code / Infinite loops Reachability properties Dead code / Deadlock Causal properties Starvation / Race Condition User-specified: Can a read occurs on a file after I closed it 14

34 From Models to Monitor Objective : building a dedicated program monitor User Process System Call Kernel System 15

35 From Models to Monitor Objective : building a dedicated program monitor Raise alarm when bad behaviors occur! User Process Monitor System Call Kernel System 15

36 From Models to Monitor Objective : building a dedicated program monitor Raise alarm when bad behaviors occur! User Process Monitor System Call Kernel System 15

37 From Models to Monitor Objective : building a dedicated program monitor Raise alarm when bad behaviors occur! User Process Monitor System Call 3 Behavior Container States Container Kernel System Embed the Petri net built during previous phase 15

38 From Models to Monitor Objective : building a dedicated program monitor Raise alarm when bad behaviors occur! 1 Sensors User Process Monitor System Call 3 Behavior Container States Container Kernel System Embed the Petri net built during previous phase 15

39 From Models to Monitor Objective : building a dedicated program monitor Raise alarm when bad behaviors occur! 1 System Call Sensors System Call System Call User Process Monitor System Call 3 Behavior Container States Container Kernel System Embed the Petri net built during previous phase Catch events related to the program execution 15

40 From Models to Monitor Objective : building a dedicated program monitor Raise alarm when bad behaviors occur! 1 System Call Sensors System Call System Call User Process Monitor 2 Firing Manager System Call 3 Behavior Container States Container Kernel System Embed the Petri net built during previous phase Catch events related to the program execution Compare real events to expected events 15

41 Playing with Nets All transitions can consume tokens from pool place Execution is divided into rounds Catching an event = beginning of a round When the pool place is empty = end of a round The pool place must be empty before beginning a new round 0_Exit Pool place Event Color open o read write r w 0_Entry [open] 0_2 close exit c e [read] 0_4 [write] 0_5 [close] 0_6 16

42 Playing with Nets All transitions can consume tokens from pool place Execution is divided into rounds Catching an event = beginning of a round When the pool place is empty = end of a round The pool place must be empty before beginning a new round 0_Exit Pool place Event Color open o read write r w 0_Entry [open] 0_2 close exit c e [read] 0_4 [write] 0_5 [close] 0_6 16

43 Playing with Nets All transitions can consume tokens from pool place Execution is divided into rounds Catching an event = beginning of a round When the pool place is empty = end of a round The pool place must be empty before beginning a new round 0_Exit o Pool place Event Color open o read write r w 0_Entry [open] 0_2 close exit c e [read] 0_4 [write] 0_5 [close] 0_6 16

44 Playing with Nets All transitions can consume tokens from pool place Execution is divided into rounds Catching an event = beginning of a round When the pool place is empty = end of a round The pool place must be empty before beginning a new round 0_Exit Pool place Event Color open o read write r w 0_Entry [open] 0_2 close exit c e [read] 0_4 [write] 0_5 [close] 0_6 16

45 Playing with Nets All transitions can consume tokens from pool place Execution is divided into rounds Catching an event = beginning of a round When the pool place is empty = end of a round The pool place must be empty before beginning a new round 0_Exit r Pool place Event Color open o read write r w 0_Entry [open] 0_2 close exit c e [read] 0_4 [write] 0_5 [close] 0_6 16

46 Playing with Nets All transitions can consume tokens from pool place Execution is divided into rounds Catching an event = beginning of a round When the pool place is empty = end of a round The pool place must be empty before beginning a new round 0_Exit Pool place Event Color open o read write r w 0_Entry [open] 0_2 close exit c e [read] 0_4 [write] 0_5 [close] 0_6 16

47 Playing with Nets All transitions can consume tokens from pool place Execution is divided into rounds Catching an event = beginning of a round When the pool place is empty = end of a round The pool place must be empty before beginning a new round 0_Exit o Pool place Event Color open o read write r w 0_Entry [open] 0_2 close exit c e [read] 0_4 [write] 0_5 [close] 0_6 16

48 Playing with Nets All transitions can consume tokens from pool place Execution is divided into rounds Catching an event = beginning of a round When the pool place is empty = end of a round The pool place must be empty before beginning a new round! 0_Exit o Pool place Event Color open o read write r w 0_Entry [open] 0_2 close exit c e [read] 0_4 [write] 0_5 [close] 0_6 16

49 Playing with Nets & Stack! Not sufficient to handle mimicry attacks Attacks that mimic a correct behavior but doing bad things - System call sequence of these attacks is correct - Introduce anomalies into call stack Event open read Color o r write w 0_Exit Pool place close exit c e 0_Entry [open] 0_2 [read] 0_4 [write] 0_5 [close] 0_6 17

50 Playing with Nets & Stack! Not sufficient to handle mimicry attacks Attacks that mimic a correct behavior but doing bad things - System call sequence of these attacks is correct - Introduce anomalies into call stack Event open read Color o r Current Stack State 0_Exit Pool place write close exit w c e 0_Entry [open] 0_2 [read] 0_4 [write] 0_5 [close] 0_6 17

51 Playing with Nets & Stack! Not sufficient to handle mimicry attacks Attacks that mimic a correct behavior but doing bad things - System call sequence of these attacks is correct - Introduce anomalies into call stack Event open read Color o r Current Stack State 0_Exit Pool place write close exit w c e 0_Entry [open] 0_2 [read] 0_4 [write] 0_5 [close] 0_6 17

52 Playing with Nets & Stack! Not sufficient to handle mimicry attacks Attacks that mimic a correct behavior but doing bad things - System call sequence of these attacks is correct - Introduce anomalies into call stack Event open read Color o r Current Stack State 0_Exit Pool place write close exit w c e 0_Entry [open] 0_2 [read] 0_4 [write] 0_5 [close] 0_6 17

53 Playing with Nets & Stack! Not sufficient to handle mimicry attacks Attacks that mimic a correct behavior but doing bad things - System call sequence of these attacks is correct - Introduce anomalies into call stack Event open read Color o r Current Stack State 0_Exit o Pool place write close exit w c e 0_Entry [open] 0_2 [read] 0_4 [write] 0_5 [close] 0_6 17

54 Playing with Nets & Stack! Not sufficient to handle mimicry attacks Attacks that mimic a correct behavior but doing bad things - System call sequence of these attacks is correct - Introduce anomalies into call stack Event open read Color o r Current Stack State 0_Exit Pool place write close exit w c e 0_Entry [open] 0_2 [read] 0_4 [write] 0_5 [close] 0_6 17

55 Playing with Nets & Stack! Not sufficient to handle mimicry attacks Attacks that mimic a correct behavior but doing bad things - System call sequence of these attacks is correct - Introduce anomalies into call stack Event open read Color o r Current Stack State 0_Exit Pool place write close exit w c e 0_Entry [open] 0_2 Return adress has been replaced during the attack! [read] 0_4 [write] 0_5 [close] 0_6 17

56 Playing with Nets & Stack! Not sufficient to handle mimicry attacks Attacks that mimic a correct behavior but doing bad things - System call sequence of these attacks is correct - Introduce anomalies into call stack Event open read Color o r Current Stack State 0_Exit r Pool place write close exit w c e 0_Entry [open] 0_2 Return adress has been replaced during the attack! [read] 0_4 [write] 0_5 [close] 0_6 17

57 Playing with Nets & Stack! Not sufficient to handle mimicry attacks Attacks that mimic a correct behavior but doing bad things - System call sequence of these attacks is correct - Introduce anomalies into call stack Event open read Color o r Current Stack State 0_Exit r Pool place write close exit w c e 0_Entry [open] 0_2 Return adress has been replaced during the attack! [read]! 0_4 [write] 0_5 [close] 0_6 17

58 Implementation: Evinrude Needs GCC Written in Java Evinrude Provide flexibility API Multi-platform Well known by engineers 18

59 Implementation: Evinrude Needs GCC Written in Java Can be plugged to Coloane GUI for C-AMI platform View / Edit / Save models Evinrude Coloane Provide flexibility API Multi-platform Well known by engineers 18

60 Implementation: Evinrude Needs GCC Written in Java Can be plugged to Coloane Evinrude Tools GUI for C-AMI platform View / Edit / Save models Provide flexibility API Multi-platform Well known by engineers Coloane C-AMI Check Petri nets syntax Allow offline analysis 18

61 Implementation: Evinrude Needs GCC Written in Java Can be plugged to Coloane Evinrude IDS Dynamic Library LD_PRELOAD Export before run Tools GUI for C-AMI platform View / Edit / Save models Provide flexibility API Multi-platform Well known by engineers Coloane C-AMI Check Petri nets syntax Allow offline analysis 18

62 Conclusion Automatic construction of a program dedicated IDS Select subset of information: Perspective mechanism Use the same model for both offline & online analysis WYCIWYC : What You ve Checked is What You ll Check Evinrude has already produced models for: Before reduction After reduction GZip 842 / 1119 / / 165 / 498 Wu-FTPD 4132 / 5331 / / 963 / 3018 LigHTTPd 3403 / 4264 / / 761 / 2392 places / transitions / arcs 19

63 Questions? Thank you for your attention... 20

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

C Grundlagen - Threads

C Grundlagen - Threads Michael Strassberger saremox@linux.com Proseminar C Grundlagen Fachbereich Informatik Fakultaet fuer Mathematik, Informatik und Naturwissenschaften Universitaet Hamburg 3. Juli 2014 Table of Contents 1

More information

French & American Educational System. Collaboration between Rutgers & Paris 6. M.S. : Distributed Systems & Applications

French & American Educational System. Collaboration between Rutgers & Paris 6. M.S. : Distributed Systems & Applications French & American Educational System French system American system Doctorat Ph.D Collaboration between Rutgers & Paris 6 22-23 Master Master s degree 21-22 Supervised by : Prof. Liviu Iftode - Univ. of

More information

Intel Threading Tools

Intel Threading Tools Intel Threading Tools Paul Petersen, Intel -1- INFORMATION IN THIS DOCUMENT IS PROVIDED IN CONNECTION WITH INTEL PRODUCTS. EXCEPT AS PROVIDED IN INTEL'S TERMS AND CONDITIONS OF SALE FOR SUCH PRODUCTS,

More information

CROWDMARK. Examination Midterm. Spring 2017 CS 350. Closed Book. Page 1 of 30. University of Waterloo CS350 Midterm Examination.

CROWDMARK. Examination Midterm. Spring 2017 CS 350. Closed Book. Page 1 of 30. University of Waterloo CS350 Midterm Examination. Times: Thursday 2017-06-22 at 19:00 to 20:50 (7 to 8:50PM) Duration: 1 hour 50 minutes (110 minutes) Exam ID: 3520593 Please print in pen: Waterloo Student ID Number: WatIAM/Quest Login Userid: Sections:

More information

Windows architecture. user. mode. Env. subsystems. Executive. Device drivers Kernel. kernel. mode HAL. Hardware. Process B. Process C.

Windows architecture. user. mode. Env. subsystems. Executive. Device drivers Kernel. kernel. mode HAL. Hardware. Process B. Process C. Structure Unix architecture users Functions of the System tools (shell, editors, compilers, ) standard library System call Standard library (printf, fork, ) OS kernel: processes, memory management, file

More information

CS342 - Spring 2019 Project #3 Synchronization and Deadlocks

CS342 - Spring 2019 Project #3 Synchronization and Deadlocks CS342 - Spring 2019 Project #3 Synchronization and Deadlocks Assigned: April 2, 2019. Due date: April 21, 2019, 23:55. Objectives Practice multi-threaded programming. Practice synchronization: mutex and

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

Semaphores. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

Semaphores. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University Semaphores Jinkyu Jeong (jinkyu@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu EEE3052: Introduction to Operating Systems, Fall 2017, Jinkyu Jeong (jinkyu@skku.edu) Synchronization

More information

CS333 Intro to Operating Systems. Jonathan Walpole

CS333 Intro to Operating Systems. Jonathan Walpole CS333 Intro to Operating Systems Jonathan Walpole Threads & Concurrency 2 Threads Processes have the following components: - an address space - a collection of operating system state - a CPU context or

More information

CS 3305 Intro to Threads. Lecture 6

CS 3305 Intro to Threads. Lecture 6 CS 3305 Intro to Threads Lecture 6 Introduction Multiple applications run concurrently! This means that there are multiple processes running on a computer Introduction Applications often need to perform

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

INF 212 ANALYSIS OF PROG. LANGS CONCURRENCY. Instructors: Crista Lopes Copyright Instructors.

INF 212 ANALYSIS OF PROG. LANGS CONCURRENCY. Instructors: Crista Lopes Copyright Instructors. INF 212 ANALYSIS OF PROG. LANGS CONCURRENCY Instructors: Crista Lopes Copyright Instructors. Basics Concurrent Programming More than one thing at a time Examples: Network server handling hundreds of clients

More information

A Deterministic Concurrent Language for Embedded Systems

A Deterministic Concurrent Language for Embedded Systems A Deterministic Concurrent Language for Embedded Systems Stephen A. Edwards Columbia University Joint work with Olivier Tardieu SHIM:A Deterministic Concurrent Language for Embedded Systems p. 1/38 Definition

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 The Process Concept 2 The Process Concept Process a program in execution

More information

pthreads CS449 Fall 2017

pthreads CS449 Fall 2017 pthreads CS449 Fall 2017 POSIX Portable Operating System Interface Standard interface between OS and program UNIX-derived OSes mostly follow POSIX Linux, macos, Android, etc. Windows requires separate

More information

Embedded Systems 7. Models of computation for embedded systems

Embedded Systems 7. Models of computation for embedded systems Embedded Systems 7 - - Models of computation for embedded systems Communication/ local computations Communicating finite state machines Data flow model Computational graphs Von Neumann model Discrete event

More information

POSIX threads CS 241. February 17, Copyright University of Illinois CS 241 Staff

POSIX threads CS 241. February 17, Copyright University of Illinois CS 241 Staff POSIX threads CS 241 February 17, 2012 Copyright University of Illinois CS 241 Staff 1 Recall: Why threads over processes? Creating a new process can be expensive Time A call into the operating system

More information

CS 475. Process = Address space + one thread of control Concurrent program = multiple threads of control

CS 475. Process = Address space + one thread of control Concurrent program = multiple threads of control Processes & Threads Concurrent Programs Process = Address space + one thread of control Concurrent program = multiple threads of control Multiple single-threaded processes Multi-threaded process 2 1 Concurrent

More information

Chapter 4 Concurrent Programming

Chapter 4 Concurrent Programming Chapter 4 Concurrent Programming 4.1. Introduction to Parallel Computing In the early days, most computers have only one processing element, known as the Central Processing Unit (CPU). Due to this hardware

More information

ENCM 501 Winter 2019 Assignment 9

ENCM 501 Winter 2019 Assignment 9 page 1 of 6 ENCM 501 Winter 2019 Assignment 9 Steve Norman Department of Electrical & Computer Engineering University of Calgary April 2019 Assignment instructions and other documents for ENCM 501 can

More information

Synchronization. CS 475, Spring 2018 Concurrent & Distributed Systems

Synchronization. CS 475, Spring 2018 Concurrent & Distributed Systems Synchronization CS 475, Spring 2018 Concurrent & Distributed Systems Review: Threads: Memory View code heap data files code heap data files stack stack stack stack m1 m1 a1 b1 m2 m2 a2 b2 m3 m3 a3 m4 m4

More information

LSN 13 Linux Concurrency Mechanisms

LSN 13 Linux Concurrency Mechanisms LSN 13 Linux Concurrency Mechanisms ECT362 Operating Systems Department of Engineering Technology LSN 13 Creating Processes fork() system call Returns PID of the child process created The new process is

More information

CFG (Control flow graph)

CFG (Control flow graph) CFG (Control flow graph) Class B T12 오지은 200814189 신승우 201011340 이종선 200811448 Introduction to CFG Algorithm to construct Control Flow Graph Statement of Purpose Q & A Introduction to CFG Algorithm to

More information

Introduction to MARIA and High-Level Petri Nets

Introduction to MARIA and High-Level Petri Nets Introduction to MARIA and High-Level Petri Nets Marko Mäkelä Laboratory for Theoretical Computer Science Helsinki University of Technology P.O.Box 9700 02015 HUT Finland October 9, 2001 Modelling Concurrent

More information

Embedded Systems 7 BF - ES - 1 -

Embedded Systems 7 BF - ES - 1 - Embedded Systems 7-1 - Production system A modelbased realtime faultdiagnosis system for technical processes Ch. Steger, R. Weiss - 2 - Sprout Counter Flow Pipeline-Processor Based on a stream of data

More information

Concurrent Programming

Concurrent Programming Concurrent Programming is Hard! Concurrent Programming Kai Shen The human mind tends to be sequential Thinking about all possible sequences of events in a computer system is at least error prone and frequently

More information

CSE 451 Midterm 1. Name:

CSE 451 Midterm 1. Name: CSE 451 Midterm 1 Name: 1. [2 points] Imagine that a new CPU were built that contained multiple, complete sets of registers each set contains a PC plus all the other registers available to user programs.

More information

Thread. Disclaimer: some slides are adopted from the book authors slides with permission 1

Thread. Disclaimer: some slides are adopted from the book authors slides with permission 1 Thread Disclaimer: some slides are adopted from the book authors slides with permission 1 IPC Shared memory Recap share a memory region between processes read or write to the shared memory region fast

More information

Final CSE 131B Spring 2004

Final CSE 131B Spring 2004 Login name Signature Name Student ID Final CSE 131B Spring 2004 Page 1 Page 2 Page 3 Page 4 Page 5 Page 6 Page 7 Page 8 (25 points) (24 points) (32 points) (24 points) (28 points) (26 points) (22 points)

More information

High Performance Computing Lecture 21. Matthew Jacob Indian Institute of Science

High Performance Computing Lecture 21. Matthew Jacob Indian Institute of Science High Performance Computing Lecture 21 Matthew Jacob Indian Institute of Science Semaphore Examples Semaphores can do more than mutex locks Example: Consider our concurrent program where process P1 reads

More information

AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS

AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS PAUL L. BAILEY Abstract. This documents amalgamates various descriptions found on the internet, mostly from Oracle or Wikipedia. Very little of this

More information

DEBUGGING: DYNAMIC PROGRAM ANALYSIS

DEBUGGING: DYNAMIC PROGRAM ANALYSIS DEBUGGING: DYNAMIC PROGRAM ANALYSIS WS 2017/2018 Martina Seidl Institute for Formal Models and Verification System Invariants properties of a program must hold over the entire run: integrity of data no

More information

Concurrent Programming

Concurrent Programming Concurrent Programming is Hard! Concurrent Programming Kai Shen The human mind tends to be sequential Thinking about all possible sequences of events in a computer system is at least error prone and frequently

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

The SPIN Model Checker

The SPIN Model Checker The SPIN Model Checker Metodi di Verifica del Software Andrea Corradini Lezione 1 2013 Slides liberamente adattate da Logic Model Checking, per gentile concessione di Gerard J. Holzmann http://spinroot.com/spin/doc/course/

More information

CSci 4061 Introduction to Operating Systems. Programs in C/Unix

CSci 4061 Introduction to Operating Systems. Programs in C/Unix CSci 4061 Introduction to Operating Systems Programs in C/Unix Today Basic C programming Follow on to recitation Structure of a C program A C program consists of a collection of C functions, structs, arrays,

More information

4.8 Summary. Practice Exercises

4.8 Summary. Practice Exercises Practice Exercises 191 structures of the parent process. A new task is also created when the clone() system call is made. However, rather than copying all data structures, the new task points to the data

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

CS510 Operating System Foundations. Jonathan Walpole

CS510 Operating System Foundations. Jonathan Walpole CS510 Operating System Foundations Jonathan Walpole The Process Concept 2 The Process Concept Process a program in execution Program - description of how to perform an activity instructions and static

More information

Threads. studykorner.org

Threads. studykorner.org Threads Thread Subpart of a process Basic unit of CPU utilization Smallest set of programmed instructions, can be managed independently by OS No independent existence (process dependent) Light Weight Process

More information

CS510 Operating System Foundations. Jonathan Walpole

CS510 Operating System Foundations. Jonathan Walpole CS510 Operating System Foundations Jonathan Walpole Threads & Concurrency 2 Why Use Threads? Utilize multiple CPU s concurrently Low cost communication via shared memory Overlap computation and blocking

More information

OPERATING SYSTEMS - ASSIGNMENT 2 SYNCHRONIZATION & THREADS

OPERATING SYSTEMS - ASSIGNMENT 2 SYNCHRONIZATION & THREADS OPERATING SYSTEMS - ASSIGNMENT 2 SYNCHRONIZATION & THREADS Introduction In this assignment we will add synchronization tools\methods to the xv6 kernel. We start with a simple binary semaphore and then

More information

Using Spin to Help Teach Concurrent Programming

Using Spin to Help Teach Concurrent Programming Using Spin to Help Teach Concurrent Programming John Regehr May 1, 1998 1 Introduction and Motivation Writing correct concurrent programs is very difficult; race conditions, deadlocks, and livelocks can

More information

Notes on the Exam. Question 1. Today. Comp 104:Operating Systems Concepts 11/05/2015. Revision Lectures (separate questions and answers)

Notes on the Exam. Question 1. Today. Comp 104:Operating Systems Concepts 11/05/2015. Revision Lectures (separate questions and answers) Comp 104:Operating Systems Concepts Revision Lectures (separate questions and answers) Today Here are a sample of questions that could appear in the exam Please LET ME KNOW if there are particular subjects

More information

POSIX PTHREADS PROGRAMMING

POSIX PTHREADS PROGRAMMING POSIX PTHREADS PROGRAMMING Download the exercise code at http://www-micrel.deis.unibo.it/~capotondi/pthreads.zip Alessandro Capotondi alessandro.capotondi(@)unibo.it Hardware Software Design of Embedded

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

AUTOBEST: A United AUTOSAR-OS And ARINC 653 Kernel. Alexander Züpke, Marc Bommert, Daniel Lohmann

AUTOBEST: A United AUTOSAR-OS And ARINC 653 Kernel. Alexander Züpke, Marc Bommert, Daniel Lohmann AUTOBEST: A United AUTOSAR-OS And ARINC 653 Kernel Alexander Züpke, Marc Bommert, Daniel Lohmann alexander.zuepke@hs-rm.de, marc.bommert@hs-rm.de, lohmann@cs.fau.de Motivation Automotive and Avionic industry

More information

IWAISE November 12, 2012

IWAISE November 12, 2012 IWAISE 2012 Modeling and Verifying Distributed Systems with Petri Nets Tutorial - Practical work Souheib Baarir Fabrice Kordon LIP6 LIP6 Université Paris Ouest Nanterre Université P. & M. Curie 200 avenue

More information

EE249 Discussion Petri Nets: Properties, Analysis and Applications - T. Murata. Chang-Ching Wu 10/9/2007

EE249 Discussion Petri Nets: Properties, Analysis and Applications - T. Murata. Chang-Ching Wu 10/9/2007 EE249 Discussion Petri Nets: Properties, Analysis and Applications - T. Murata Chang-Ching Wu 10/9/2007 What are Petri Nets A graphical & modeling tool. Describe systems that are concurrent, asynchronous,

More information

3C03 Concurrency: Starvation and Deadlocks

3C03 Concurrency: Starvation and Deadlocks 3C03 Concurrency: Starvation and Deadlocks Wolfgang Emmerich 1 Goals Reader/Writer problem Starvation Dining Philosophers Problem Deadlocks Liveness Analysis using LTS 2 1 Reader / Writer Problem Monitors

More information

Spring CS 170 Exercise Set 1 (Updated with Part III)

Spring CS 170 Exercise Set 1 (Updated with Part III) Spring 2015. CS 170 Exercise Set 1 (Updated with Part III) Due on May 5 Tuesday 12:30pm. Submit to the CS170 homework box or bring to the classroom. Additional problems will be added as we cover more topics

More information

Comp 204: Computer Systems and Their Implementation. Lecture 25a: Revision Lectures (separate questions and answers)

Comp 204: Computer Systems and Their Implementation. Lecture 25a: Revision Lectures (separate questions and answers) Comp 204: Computer Systems and Their Implementation Lecture 25a: Revision Lectures (separate questions and answers) 1 Today Here are a sample of questions that could appear in the exam Please LET ME KNOW

More information

I 1 : {E E, E E +E, E E E}

I 1 : {E E, E E +E, E E E} Remark on error handling in LR parsing Example E E + E E E (E) a Typically errors are handled by adding actions to the parsing table error routines that print diagnostic messages and recover in some fashion

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

COMP 181 Compilers. Administrative. Last time. Prelude. Compilation strategy. Translation strategy. Lecture 2 Overview

COMP 181 Compilers. Administrative. Last time. Prelude. Compilation strategy. Translation strategy. Lecture 2 Overview COMP 181 Compilers Lecture 2 Overview September 7, 2006 Administrative Book? Hopefully: Compilers by Aho, Lam, Sethi, Ullman Mailing list Handouts? Programming assignments For next time, write a hello,

More information

CPSC 341 OS & Networks. Threads. Dr. Yingwu Zhu

CPSC 341 OS & Networks. Threads. Dr. Yingwu Zhu CPSC 341 OS & Networks Threads Dr. Yingwu Zhu Processes Recall that a process includes many things An address space (defining all the code and data pages) OS resources (e.g., open files) and accounting

More information

Distributed systems. Programming with threads

Distributed systems. Programming with threads Distributed systems Programming with threads Reviews on OS concepts Each process occupies a single address space Reviews on OS concepts A thread of (execution) control has its own PC counter, stack pointer

More information

unsigned char memory[] STACK ¼ 0x xC of address space globals function KERNEL code local variables

unsigned char memory[] STACK ¼ 0x xC of address space globals function KERNEL code local variables Graded assignment 0 will be handed out in section Assignment 1 Not that bad Check your work (run it through the compiler) Factorial Program Prints out ENTERING, LEAVING, and other pointers unsigned char

More information

Solution: Petri nets Homework 1. Discussed on Thursday 21 st April, 2016.

Solution: Petri nets Homework 1. Discussed on Thursday 21 st April, 2016. Technische Universität München (I7) Summer term 2016 Prof. J. Esparza / P. Meyer Thursday 14 th April, 2016 Solution Petri nets Homework 1 Discussed on Thursday 21 st April, 2016. For questions regarding

More information

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

Sections 01 (11:30), 02 (16:00), 03 (8:30) Ashraf Aboulnaga & Borzoo Bonakdarpour Course CS350 - Operating Systems Sections 01 (11:30), 02 (16:00), 03 (8:30) Instructor Ashraf Aboulnaga & Borzoo Bonakdarpour Date of Exam October 25, 2011 Time Period 19:00-21:00 Duration of Exam Number

More information

Instructions to use PIPE+

Instructions to use PIPE+ Instructions to use PIPE+ PIPE+ is implemented under the environment of Eclipse. User can import it into eclipse to view source code as well as run the program. The user can choose RunGUI to run the tool.

More information

CPSC 213. Introduction to Computer Systems. The Operating System. Unit 2e

CPSC 213. Introduction to Computer Systems. The Operating System. Unit 2e CPSC 213 Introduction to Computer Systems Unit 2e The Operating System 1 Readings for Next Two Lectures Text Exceptional Control Flow: Processes, System Call Error Handling VM as a Tool for Memory Protection

More information

Multithreaded Programming Part II. CSE 219 Stony Brook University, Department of Computer Science

Multithreaded Programming Part II. CSE 219 Stony Brook University, Department of Computer Science Multithreaded Programming Part II CSE 219 Stony Brook University, Thread Scheduling In a Java application, main is a thread on its own Once multiple threads are made Runnable the thread scheduler of the

More information

CS 3113 Introduction to Operating Systems Midterm October 11, 2018

CS 3113 Introduction to Operating Systems Midterm October 11, 2018 General instructions: CS 3113 Introduction to Operating Systems Midterm October 11, 2018 Please wait to open this exam booklet until you are told to do so. This examination booklet has 10 pages. You also

More information

CS 3113 Introduction to Operating Systems Midterm October 11, 2018

CS 3113 Introduction to Operating Systems Midterm October 11, 2018 General instructions: CS 3113 Introduction to Operating Systems Midterm October 11, 2018 Please wait to open this exam booklet until you are told to do so. This examination booklet has 10 pages. You also

More information

Question 1. Notes on the Exam. Today. Comp 104: Operating Systems Concepts 11/05/2015. Revision Lectures

Question 1. Notes on the Exam. Today. Comp 104: Operating Systems Concepts 11/05/2015. Revision Lectures Comp 104: Operating Systems Concepts Revision Lectures Today Here are a sample of questions that could appear in the exam Please LET ME KNOW if there are particular subjects you want to know about??? 1

More information

Processes and Threads

Processes and Threads TDDI04 Concurrent Programming, Operating Systems, and Real-time Operating Systems Processes and Threads [SGG7] Chapters 3 and 4 Copyright Notice: The lecture notes are mainly based on Silberschatz s, Galvin

More information

Mon Sep 17, 2007 Lecture 3: Process Management

Mon Sep 17, 2007 Lecture 3: Process Management Mon Sep 17, 2007 Lecture 3: Process Management September 19, 2007 1 Review OS mediates between hardware and user software QUIZ: Q: Name three layers of a computer system where the OS is one of these layers.

More information

Process Management And Synchronization

Process Management And Synchronization Process Management And Synchronization In a single processor multiprogramming system the processor switches between the various jobs until to finish the execution of all jobs. These jobs will share the

More information

0x1A Great Papers in Computer Security

0x1A Great Papers in Computer Security CS 380S 0x1A Great Papers in Computer Security Vitaly Shmatikov http://www.cs.utexas.edu/~shmat/courses/cs380s/ slide 1 After All Else Fails Intrusion prevention Find buffer overflows and remove them Use

More information

CS 314 Principles of Programming Languages. Lecture 9

CS 314 Principles of Programming Languages. Lecture 9 CS 314 Principles of Programming Languages Lecture 9 Zheng Zhang Department of Computer Science Rutgers University Wednesday 5 th October, 2016 Zheng Zhang 1 CS@Rutgers University Class Information Homework

More information

CS 326 Operating Systems C Programming. Greg Benson Department of Computer Science University of San Francisco

CS 326 Operating Systems C Programming. Greg Benson Department of Computer Science University of San Francisco CS 326 Operating Systems C Programming Greg Benson Department of Computer Science University of San Francisco Why C? Fast (good optimizing compilers) Not too high-level (Java, Python, Lisp) Not too low-level

More information

1 of 6 Lecture 7: March 4. CISC 879 Software Support for Multicore Architectures Spring Lecture 7: March 4, 2008

1 of 6 Lecture 7: March 4. CISC 879 Software Support for Multicore Architectures Spring Lecture 7: March 4, 2008 1 of 6 Lecture 7: March 4 CISC 879 Software Support for Multicore Architectures Spring 2008 Lecture 7: March 4, 2008 Lecturer: Lori Pollock Scribe: Navreet Virk Open MP Programming Topics covered 1. Introduction

More information

CMSC 132: Object-Oriented Programming II. Threads in Java

CMSC 132: Object-Oriented Programming II. Threads in Java CMSC 132: Object-Oriented Programming II Threads in Java 1 Problem Multiple tasks for computer Draw & display images on screen Check keyboard & mouse input Send & receive data on network Read & write files

More information

CSE332: Data Abstractions Lecture 25: Deadlocks and Additional Concurrency Issues. Tyler Robison Summer 2010

CSE332: Data Abstractions Lecture 25: Deadlocks and Additional Concurrency Issues. Tyler Robison Summer 2010 CSE332: Data Abstractions Lecture 25: Deadlocks and Additional Concurrency Issues Tyler Robison Summer 2010 1 Where we are We ve covered basic concurrency, then some odds and ends: Readers/writer locks

More information

Concurrency & Parallelism. Threads, Concurrency, and Parallelism. Multicore Processors 11/7/17

Concurrency & Parallelism. Threads, Concurrency, and Parallelism. Multicore Processors 11/7/17 Concurrency & Parallelism So far, our programs have been sequential: they do one thing after another, one thing at a. Let s start writing programs that do more than one thing at at a. Threads, Concurrency,

More information

COP 4610: Introduction to Operating Systems (Spring 2015) Chapter 4: Threads. Zhi Wang Florida State University

COP 4610: Introduction to Operating Systems (Spring 2015) Chapter 4: Threads. Zhi Wang Florida State University COP 4610: Introduction to Operating Systems (Spring 2015) Chapter 4: Threads Zhi Wang Florida State University Contents Thread overview Multithreading models Thread libraries Threading issues Operating

More information

( D ) 4. Which is not able to solve the race condition? (A) Test and Set Lock (B) Semaphore (C) Monitor (D) Shared memory

( D ) 4. Which is not able to solve the race condition? (A) Test and Set Lock (B) Semaphore (C) Monitor (D) Shared memory CS 540 - Operating Systems - Final Exam - Name: Date: Wenesday, May 12, 2004 Part 1: (78 points - 3 points for each problem) ( C ) 1. In UNIX a utility which reads commands from a terminal is called: (A)

More information

ECE 3574: Applied Software Design. Threads

ECE 3574: Applied Software Design. Threads ECE 3574: Applied Software Design Threads Today we are going to start looking at threads, multiple executing programs within the same process that share the code segment and heap, but have separate stacks.

More information

PRACE Autumn School Basic Programming Models

PRACE Autumn School Basic Programming Models PRACE Autumn School 2010 Basic Programming Models Basic Programming Models - Outline Introduction Key concepts Architectures Programming models Programming languages Compilers Operating system & libraries

More information

Core Java - SCJP. Q2Technologies, Rajajinagar. Course content

Core Java - SCJP. Q2Technologies, Rajajinagar. Course content Core Java - SCJP Course content NOTE: For exam objectives refer to the SCJP 1.6 objectives. 1. Declarations and Access Control Java Refresher Identifiers & JavaBeans Legal Identifiers. Sun's Java Code

More information

Concurrent Programming

Concurrent Programming Indian Institute of Science Bangalore, India भ रत य व ज ञ न स स थ न ब गल र, भ रत SE 292: High Performance Computing [3:0][Aug:2014] Concurrent Programming Yogesh Simmhan Adapted from Intro to Concurrent

More information

Threads, Concurrency, and Parallelism

Threads, Concurrency, and Parallelism Threads, Concurrency, and Parallelism Lecture 24 CS2110 Spring 2017 Concurrency & Parallelism So far, our programs have been sequential: they do one thing after another, one thing at a time. Let s start

More information

The Dining Philosophers Problem CMSC 330: Organization of Programming Languages

The Dining Philosophers Problem CMSC 330: Organization of Programming Languages The Dining Philosophers Problem CMSC 0: Organization of Programming Languages Threads Classic Concurrency Problems Philosophers either eat or think They must have two forks to eat Can only use forks on

More information

Chapter 4: Threads. Operating System Concepts. Silberschatz, Galvin and Gagne

Chapter 4: Threads. Operating System Concepts. Silberschatz, Galvin and Gagne Chapter 4: Threads Silberschatz, Galvin and Gagne Chapter 4: Threads Overview Multithreading Models Thread Libraries Threading Issues Operating System Examples Linux Threads 4.2 Silberschatz, Galvin and

More information

PROGRAMMAZIONE I A.A. 2017/2018

PROGRAMMAZIONE I A.A. 2017/2018 PROGRAMMAZIONE I A.A. 2017/2018 FUNCTIONS INTRODUCTION AND MAIN All the instructions of a C program are contained in functions. üc is a procedural language üeach function performs a certain task A special

More information

A Deterministic Concurrent Language for Embedded Systems

A Deterministic Concurrent Language for Embedded Systems A Deterministic Concurrent Language for Embedded Systems Stephen A. Edwards Columbia University Joint work with Olivier Tardieu SHIM:A Deterministic Concurrent Language for Embedded Systems p. 1/30 Definition

More information

Concurrency, Thread. Dongkun Shin, SKKU

Concurrency, Thread. Dongkun Shin, SKKU Concurrency, Thread 1 Thread Classic view a single point of execution within a program a single PC where instructions are being fetched from and executed), Multi-threaded program Has more than one point

More information

Lecture 4 Threads. (chapter 4)

Lecture 4 Threads. (chapter 4) Bilkent University Department of Computer Engineering CS342 Operating Systems Lecture 4 Threads (chapter 4) Dr. İbrahim Körpeoğlu http://www.cs.bilkent.edu.tr/~korpe 1 References The slides here are adapted/modified

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 4: Processes (2) Threads Process Creation: Unix In Unix, processes are created using fork() int fork() fork() Creates and initializes a new PCB Creates

More information

COMP4510 Introduction to Parallel Computation. Shared Memory and OpenMP. Outline (cont d) Shared Memory and OpenMP

COMP4510 Introduction to Parallel Computation. Shared Memory and OpenMP. Outline (cont d) Shared Memory and OpenMP COMP4510 Introduction to Parallel Computation Shared Memory and OpenMP Thanks to Jon Aronsson (UofM HPC consultant) for some of the material in these notes. Outline (cont d) Shared Memory and OpenMP Including

More information

Announcements! P1 part 1 due next Tuesday P1 part 2 due next Friday

Announcements! P1 part 1 due next Tuesday P1 part 2 due next Friday Announcements! P1 part 1 due next Tuesday P1 part 2 due next Friday 1 Finite-state machines CS 536 Last time! A compiler is a recognizer of language S (Source) a translator from S to T (Target) a program

More information

Closures. Mooly Sagiv. Michael Clarkson, Cornell CS 3110 Data Structures and Functional Programming

Closures. Mooly Sagiv. Michael Clarkson, Cornell CS 3110 Data Structures and Functional Programming Closures Mooly Sagiv Michael Clarkson, Cornell CS 3110 Data Structures and Functional Programming t ::= x x. t t t Call-by-value big-step Operational Semantics terms variable v ::= values abstraction x.

More information

CMSC 330: Organization of Programming Languages. The Dining Philosophers Problem

CMSC 330: Organization of Programming Languages. The Dining Philosophers Problem CMSC 330: Organization of Programming Languages Threads Classic Concurrency Problems The Dining Philosophers Problem Philosophers either eat or think They must have two forks to eat Can only use forks

More information

The deadlock problem

The deadlock problem Deadlocks Arvind Krishnamurthy Spring 2004 The deadlock problem A set of blocked processes each holding a resource and waiting to acquire a resource held by another process. Example locks A and B P 0 P

More information

WEEK 5 - APPLICATION OF PETRI NETS. 4.4 Producers-consumers problem with priority

WEEK 5 - APPLICATION OF PETRI NETS. 4.4 Producers-consumers problem with priority 4.4 Producers-consumers problem with priority The net shown in Fig. 27 represents a producers-consumers system with priority, i.e., consumer A has priority over consumer B in the sense that A can consume

More information

Chapter 6: Process Synchronization

Chapter 6: Process Synchronization Chapter 6: Process Synchronization Objectives Introduce Concept of Critical-Section Problem Hardware and Software Solutions of Critical-Section Problem Concept of Atomic Transaction Operating Systems CS

More 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

CMPS 111 Spring 2013 Prof. Scott A. Brandt Midterm Examination May 6, Name: ID:

CMPS 111 Spring 2013 Prof. Scott A. Brandt Midterm Examination May 6, Name: ID: CMPS 111 Spring 2013 Prof. Scott A. Brandt Midterm Examination May 6, 2013 Name: ID: This is a closed note, closed book exam. There are 23 multiple choice questions, 6 short answer questions. Plan your

More information