Distributed Internet Applications - DIA. Processes and Threads

Size: px
Start display at page:

Download "Distributed Internet Applications - DIA. Processes and Threads"

Transcription

1 Distributed Internet Applications - DIA Processes and Threads 1

2 Operating Systems Basics The Processes A process consists of an executing program, its current values, state information, and the resources used by the operating system to manage its execution. A program is a text written by a programmer; a process is a dynamic entity which exists only when a program is executing. 2

3 Process State As a process executes, it changes state. Each process may be in following states: New: The process is being created. Running: Instructions are being executed. Waiting: The process is waiting for some event to occur. Ready: The process is waiting to be assigned to a processor. Terminated: The process has finished the execution. 3

4 Process State Transition Diagram new queued terminated exit ready dispatch running blocked event completion waiting for an event Simplifed finite state diagram for a process's lifetime 4

5 Concurrent Processing On operating systems, multiple processes appear to be executing concurrently on a machine by timesharing resources. 5

6 Parent and Child Processes At run time, a process may spawn child processes. The original process, called the parent process, continues to run concurrently with the child processes. A child process is a complete process. parent process A parent process can be notified when a child process has terminated. child processes 6

7 Process Creation When a process create a child process, two possibilities exist in terms of execution: The parent continues to execute concurrently with its children. The parent waits until some or all of its children have terminated. There are two possibilities in terms of the address space of the child process: The child process is a duplicate of the parent process. The child process has a program loaded into it 7

8 Creating a New Process in Ruby fork splits a running program into two nearly identical processes that can be identified by the return value of the fork call. There are to ways of using fork method: pid = fork if pid.nil? # child s code goes here else # parent s code goes here... Process.wait pid = fork do # child s code goes here # parent s code goes here... Process.wait 8

9 Example 1 global = 0 pid = fork do global += 1 puts "Child: global = #{global exit Process.wait puts "Parent: Child Complete" puts "Parent: global = #{global" Child: global = 1 Parent: Child Complete Parent: global = 0 9

10 Example 2 global = 0 pid = fork if pid.nil? global += 1 puts "Child: global = #{global" else Process.wait puts "Parent: Child Complete" puts "Parent: global = #{global Child: global = 1 Parent: Child Complete Parent: global = 0 10

11 Example 3 global = 0 Output: see next slide pid = fork if pid.nil? exec( ls, -l ) global += 1 puts "Child: global = #{global" else Process.wait puts "Parent: Child Complete" puts "Parent: global = #{global 11

12 Example 3 total 552 drwxr-xr-x 9 mortezan mortezan -rw-r--r-- 1 mortezan mortezan -rw-r--r-- 1 mortezan mortezan -rw-r--r-- 1 mortezan mortezan -rw-r--r-- 1 mortezan mortezan -rw-r--r-- 1 mortezan mortezan -rw-r--r-- 1 mortezan mortezan Parent: Child Complete Parent: global = Nov 23:41 dia Nov 18:57 dia.html Nov 23:26 example1.rb Nov 16:08 example2.rb Nov 14:00 process.rb Nov 23:17 spinner1.rb Nov 17:44 web-portal.rtf 12

13 Threads A process may spawn threads, also known as light weight processes. Threads carry a minimum of state information. a process Threads behave the same as processes. main thread child thread 1 Concurrent processing within a process child thread 2 13

14 Coordination of Threads The concurrent execution of threads may result in a race conditions. Critical section: A code segment that can be executed concurrently by more than one thread. Mutual exclusion: A method to ensure that a critical section can only be executed by one thread at a time. Programming using threads is called multi-threaded programming. A multi-threaded program that written to guard against race conditions is said to be thread-safe. 14

15 Threads in Ruby We use multiple threads to split up cooperating tasks within the program. Threads in Ruby are totally in-process, implemented within the Ruby interpreter. Threads in Ruby are completely portable. 15

16 Class Thread When a Ruby script starts up, there is usually a single thread, named main thread. $ irb --simple-prompt ruby> Thread.main => #<Thread:0x348f8 run> From within a Ruby script, there are many ways to create a new thread of execution. 16

17 Creating Threads (1) Using Thread::new Thread.new([args]*) { args thread body or Thread.new([args]*) do args thread body Thread::fork is a synonym for Thread::new. 17

18 Creating Threads (2) names = %w(one two three) threads = [] for name in names threads << Thread.new(name) { myname sleep 10*rand puts "I am thread number: #{myname" threads.each { athread athread.join puts "I am the parent thread" 18

19 Passing Parameters (1) a = 1 b = 4 c = 3 t1 = Thread.new(a,b,c) do x,y,z a = x**2 Wait for t1 to finish b = y**2 c = z**2 t1.join puts "Parent: a = #{a, b = #{b, c = #{c" Output: Parent thread: a = 1, b = 16, c = 9 19

20 Passing Parameters (2) a = 1 b = 4 Defined in main thread c = 3 thread = Thread.new(a,b,c) do x,y,z sleep(rand(0)) a = x**2 b = y**2 c = z**2 sleep(rand(0)) puts "Parent: a = #{a, b = #{b, c = #{c" Output 1: Parent: a = 1, b = 16, c = 9 Output 2: Parent: a = 1, b = 4, c = 3 20

21 Manipulating Threads When a Ruby program terminates, all running threads are killed, regardless of their states. The parent thread can wait for a child thread by calling that child thread s Thread#join method. global = 0 t1 = Thread.new { t2 = Thread.new { sleep(rand(0)) global +=1 t3 = Thread.new { Output: Top thread: global = 2 21 sleep(rand(0)) global +=1 t3.join t2.join t1.join puts "Top thread: global = #{global"

22 Using Thread#join (1) global = 0 t1 = Thread.new { t2 = Thread.new { sleep(rand(0)) global +=1 t3 = Thread.new { sleep(rand(0)) global +=1 sleep(rand(0)) puts "Top thread: global = #{global" Possible outputs: Top thread: global = 0 or Top thread: global = 2 or Top thread: global = 1 22

23 Using Thread#join (2) Using Thread#join global = 0 t1 = Thread.new { t2 = Thread.new { global +=1 t3 = Thread.new { global +=1 Possible output: Top thread: global = 2 t3.join t2.join t1.join puts "Top thread: global = #{global" 23

24 Exporting Local Variables (1) a = 1000 # global t1 = Thread.new { t = Thread.current a = 1 # global b = "local to this thread" t[:a] = "accessible variable" Exported variables are accessible from other threads even after the thread that owned them is dead. b = t1[:a] puts "Parent: a = #{a, b = #{b" Output: Parent: a = 1, b = accessible variable At this point is thread t1 dead 24

25 Exporting Local Variables (2) t1 = Thread.new { t = Thread.current x = "renilreb nie nib hci" t[:a] = x x.reverse! b = t1[:a] puts "Parent: #{b" Output: Parent: Ich bin ein Berliner An object reference to a true local variable can be used as a sort of shorthand within the thread. 25

26 Thread.list and Thread.kill Methods t1 = Thread.new { sleep(1000) t2 = Thread.new do Output: if (Thread.current == Thread.main) Number of living threads: 3 puts "This is the main thread" Number of living threads: 2 Number of living threads: 2 1.upto(100) do Number of living threads: 1 sleep 0.1 count = Thread.list.size puts "Number of living threads: #{count" Thread.kill(t1) count = Thread.list.size puts "Number of living threads: #{count" count = Thread.list.size puts "Number of living threads: #{count" t2.join count = Thread.list.size puts "Number of living threads: #{count" 26

27 Controlling the Thread Scheduler (1) Thread::stop stops the execution of the current thread, putting it into a sleep state A thread that is stopped can be awakened by parent thread using the Thread#run or Thread#wakeup methods. The status of a thread can be determined using Thread#status method. 27

28 Controlling the Thread Scheduler (2) t1 = Thread.new { print "one\n" Thread.stop print "second\n" puts "Status of thread t1: #{t1.status" print "three\n" t1.run Output: one Status of thread t1: sleep three second 28

29 Controlling the Thread Scheduler (3) t1 = Thread.new { sleep(1000) t2 = Thread.new { loop { t3 = Thread.new { Thread.stop puts "I am thread t3" loop { t4 = Thread.new { Thread.exit t5 = Thread.new { raise "exception" puts "Status of thread t1: #{t1.status" puts "Status of thread t2: #{t2.status" puts "Status of thread t3: #{t3.status" puts "Status of thread t4: #{t4.status" puts "Status of thread t5: #{t5.status" t3.wakeup sleep 0.1 puts "Status of thread t3: #{t3.status" Thread.kill(t3) puts "Status of thread t3: #{t3.status" 29 Status of thread t1: sleep Status of thread t2: run Status of thread t3: sleep Status of thread t4: false Status of thread t5: I am thread t3 Status of thread t3: run Status of thread t3: false

30 Controlling Threads with Thread::pass t1 = Thread.new { print "one"; Thread.pass print "two"; Thread.pass print "three" t2 = Thread.new { print "1"; Thread.pass print "2"; Thread.pass print "3" t1.join; t2.join 30 Thread::pass method invokes The scheduler to pass execution To another thread. Output: one1two2three3

31 Using Thread#alive? t1 = Thread.new { loop { t2 = Thread.new { Thread.stop t3 = Thread.new { Thread.exit puts "t1 alive? -> #{t1.alive?" puts "t2 alive? -> #{t2.alive?" t1 alive? -> true puts "t3 alive? -> #{t3.alive?" t2 alive? -> true sleep 1 t3 alive? -> false if t1.alive? t1 alive? -> false Thread.kill(t1) t2 alive? -> true t2.run if t2.alive? & t2.status == "sleep" puts "t1 alive? -> #{t1.alive?" puts "t2 alive? -> #{t2.alive?" 31

32 Changing Priority t.priority returns the priority of t Higher-priority threads will run before lower-priority threads t1 = Thread.new { loop {sleep 1 t2 = Thread.new { loop {sleep 1 t3 = Thread.new { loop {sleep 1 puts "t1 priority? -> #{t1.priority" puts "t2 priority? -> #{t2.priority" puts "t3 priority? -> #{t3.priority" t1.priority = rand(10) t2.priority = rand(10) t3.priority = rand(10) puts "t1 priority? -> #{t1.priority" puts "t2 priority? -> #{t2.priority" puts "t3 priority? -> #{t3.priority" sleep 1 32 t1 priority? -> 0 t2 priority? -> 0 t3 priority? -> 0 t1 priority? -> 9 t2 priority? -> 9 t3 priority? -> 5

33 Threads an Exceptions What happens if a thread raises an unhandled exception? It deps on a flag called abort_on_exception that operates both at the class and instance level. If abort_on_exception is false, an unhandled exception terminates the current threads. If abort_on_exception is true, an unhandled exception will terminate all running threads. 33

34 abort_on_exception Thread#raise raises an exception and terminates the current thread. The flag abort_on_exception is false by default. Status of t1: sleep Status of t2: run t1 is terminated with an exception Status of t2: run a = 1 b = 0 t1 = Thread.new(a,b) { x,y Thread.stop raise "divide by zero!" if y == 0 a/b t2 = Thread.new {loop{ sleep 1 puts "Status of t1: #{t1.status" puts "Status of t2: #{t2.status" t1.run sleep rand(0.5) if t1.status == nil puts "t1 is terminated with an exception" puts "Status of t2: #{t2.status" 34

35 abort_on_exception All running threads will terminate if an unhandled exception arises. Status of t1: sleep Status of t2: run example1.rb:6: divide by zero! (RuntimeError) from example1.rb:4:in `initialize' from example1.rb:4:in `new' from example1.rb:4 35 a = 1 b = 0 Thread.abort_on_exception = true t1 = Thread.new(a,b) { x,y Thread.stop raise "divide by zero!" if y == 0 a/b t2 = Thread.new {loop{ sleep 1 puts "Status of t1: #{t1.status" puts "Status of t2: #{t2.status" t1.run puts "Status of t1: #{t1.status" puts "Status of t2: #{t2.status"

36 Using Thread#abort_on_exption threads = [] 10.times { i threads << Thread.new(i) { Thread.stop puts "Thread #{i" raise "Thread #{i raises an exception!" if i == 6 threads[6].abort_on_exception = true threads.each { t t.run t.join Ex1.rb:6: Thread 6 raises an exception! (RuntimeError) from Ex1.rb:3:in `initialize' from Ex1.rb:3:in `new' from Ex1.rb:3 from Ex1.rb:2:in `times' from Ex1.rb:

37 Synchronizing Threads c1 = c2 = 0 diff = 0 t1 = Thread.new do Race Condition loop do c1 += 1; c2 += 1 t2 = Thread.new do loop do diff += (c1 - c2).abs sleep 1 Thread.critical = true puts "c1 = #{c1, c2 = #{c2, diff = #{diff" c1 = , c2 = , diff =

38 Synchronization with Critical Section c1 = c2 = 0 diff = 0 t1 = Thread.new do loop do Thread.critical = true c1 +=1; c2 += 1 Thread.critical = false t2 = Thread.new do loop do Thread.critical = true diff += (c1 - c2).abs Thread.critical = false puts "c1 = #{c1, c2 = #{c2, diff = #{diff" c1 = 1568, c2 = 1568, diff = 0 38

39 Mutual Exclusion (1) require 'thread' mutex = Mutex.new A Mutex object acting as a semaphore. c1 = c2 = 0 diff = 0 t1 = Thread.new do loop do mutex.synchronize { c1 += 1; c2 += 1 c1 = 15407, c2 = 15407, diff = 0 t2 = Thread.new do loop do mutex.synchronize { diff += (c1 - c2).abs sleep 1 mutex.lock puts "c1 = #{c1, c2 = #{c2, diff = #{diff" 39

40 Mutual Exclusion (2) require "thread.rb" c1 = c2 = 0 diff = 0 $mutex = Mutex.new t1 = Thread.new do loop do $mutex.lock c1 +=1; c2 += 1 $mutex.unlock t2 = Thread.new do loop do $mutex.lock diff += (c1 - c2).abs $mutex.unlock #sleep 1 puts "c1 = #{c1, c2 = #{c2, diff = #{diff" c1 = 1268, c2 = 1268, diff = 0 40

41 Monitor Monitor is a fundamental high-level synchronization construct. Monitor is implemented in Ruby in the form of the monitor.rb library. A monitor presents a set of programmer defined operations that are provided mutual exclusion within the monitor. 41

42 Example: Bounded Buffer Monitor A condition variable 1 # file: MonitorBuffer.rb 2 require "monitor.rb" 3 class Buffer 4 def initialize = [] = Monitor.new 8 9 def enter(item) do def remove do Wait until buffer is not empty

43 Example: Bounded Buffer Monitor 25 class BoundedBuffer<Buffer 26 attr :max_size 27 def initialize(max_value) 28 super() = max_value def enter(item) do super(item)

44 Example: Bounded Buffer Monitor 40 def remove do 42 item = super return item def max_size=(max_value) do = max_value

45 Using Bounded Buffer Monitor Require MonitorBuffer.rb buffer = BoundedBuffer.new(5) consumer = Thread.new do loop { puts "Consumer: #{buffer.remove" sleep rand(2) producer = Thread.new do loop { item = "A"+(rand 10).to_s puts "Producer produces: #{item" buffer.enter(item) sleep rand(3) producer.join consumer.join 45 Consumer Thread Producer Thread

Ruby Programming Language Threads and Processes

Ruby Programming Language Threads and Processes Ruby Programming Language Threads and Processes Computer Science and Engineering IIT Bombay November 29, 2004 Introduction Threads Introduction Threading often improves program response time by making

More information

Processes The Process Model. Chapter 2. Processes and Threads. Process Termination. Process Creation

Processes The Process Model. Chapter 2. Processes and Threads. Process Termination. Process Creation Chapter 2 Processes The Process Model Processes and Threads 2.1 Processes 2.2 Threads 2.3 Interprocess communication 2.4 Classical IPC problems 2.5 Scheduling Multiprogramming of four programs Conceptual

More information

Processes The Process Model. Chapter 2 Processes and Threads. Process Termination. Process States (1) Process Hierarchies

Processes The Process Model. Chapter 2 Processes and Threads. Process Termination. Process States (1) Process Hierarchies Chapter 2 Processes and Threads Processes The Process Model 2.1 Processes 2.2 Threads 2.3 Interprocess communication 2.4 Classical IPC problems 2.5 Scheduling Multiprogramming of four programs Conceptual

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

Threads. Threads The Thread Model (1) CSCE 351: Operating System Kernels Witawas Srisa-an Chapter 4-5

Threads. Threads The Thread Model (1) CSCE 351: Operating System Kernels Witawas Srisa-an Chapter 4-5 Threads CSCE 351: Operating System Kernels Witawas Srisa-an Chapter 4-5 1 Threads The Thread Model (1) (a) Three processes each with one thread (b) One process with three threads 2 1 The Thread Model (2)

More information

Processes Prof. James L. Frankel Harvard University. Version of 6:16 PM 10-Feb-2017 Copyright 2017, 2015 James L. Frankel. All rights reserved.

Processes Prof. James L. Frankel Harvard University. Version of 6:16 PM 10-Feb-2017 Copyright 2017, 2015 James L. Frankel. All rights reserved. Processes Prof. James L. Frankel Harvard University Version of 6:16 PM 10-Feb-2017 Copyright 2017, 2015 James L. Frankel. All rights reserved. Process Model Each process consists of a sequential program

More information

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Organization of Programming Languages Multithreading 2 Ruby Threads Thread Creation Create thread using Thread.new New method takes code block argument t = Thread.new { body of thread t = Thread.new

More information

Chapter 3: Processes. Operating System Concepts 8th Edition,

Chapter 3: Processes. Operating System Concepts 8th Edition, Chapter 3: Processes, Administrivia Friday: lab day. For Monday: Read Chapter 4. Written assignment due Wednesday, Feb. 25 see web site. 3.2 Outline What is a process? How is a process represented? Process

More information

Getting to know you. Anatomy of a Process. Processes. Of Programs and Processes

Getting to know you. Anatomy of a Process. Processes. Of Programs and Processes Getting to know you Processes A process is an abstraction that supports running programs A sequential stream of execution in its own address space A process is NOT the same as a program! So, two parts

More information

Ruby Threads Thread Creation. CMSC 330: Organization of Programming Languages. Ruby Threads Condition. Ruby Threads Locks.

Ruby Threads Thread Creation. CMSC 330: Organization of Programming Languages. Ruby Threads Condition. Ruby Threads Locks. CMSC 330: Organization of Programming Languages Multithreading 2 Ruby Threads Thread Creation Create thread using Thread.new New method takes code block argument t = Thread.new { body of thread t = Thread.new

More information

Chapter 3: Process-Concept. Operating System Concepts 8 th Edition,

Chapter 3: Process-Concept. Operating System Concepts 8 th Edition, Chapter 3: Process-Concept, Silberschatz, Galvin and Gagne 2009 Chapter 3: Process-Concept Process Concept Process Scheduling Operations on Processes Interprocess Communication 3.2 Silberschatz, Galvin

More information

CMSC 330: Organization of Programming Languages. Concurrency & Multiprocessing

CMSC 330: Organization of Programming Languages. Concurrency & Multiprocessing CMSC 330: Organization of Programming Languages Concurrency & Multiprocessing Multiprocessing Multiprocessing: The use of multiple parallel computations We have entered an era of multiple cores... Hyperthreading

More information

Chapter 2 Processes and Threads. Interprocess Communication Race Conditions

Chapter 2 Processes and Threads. Interprocess Communication Race Conditions Chapter 2 Processes and Threads [ ] 2.3 Interprocess communication 2.4 Classical IPC problems 2.5 Scheduling 85 Interprocess Communication Race Conditions Two processes want to access shared memory at

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

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

Process a program in execution; process execution must progress in sequential fashion. Operating Systems

Process a program in execution; process execution must progress in sequential fashion. Operating Systems Process Concept An operating system executes a variety of programs: Batch system jobs Time-shared systems user programs or tasks 1 Textbook uses the terms job and process almost interchangeably Process

More information

Subject: Operating System (BTCOC403) Class: S.Y.B.Tech. (Computer Engineering)

Subject: Operating System (BTCOC403) Class: S.Y.B.Tech. (Computer Engineering) A. Multiple Choice Questions (60 questions) Subject: Operating System (BTCOC403) Class: S.Y.B.Tech. (Computer Engineering) Unit-I 1. What is operating system? a) collection of programs that manages hardware

More information

Recap: Thread. What is it? What does it need (thread private)? What for? How to implement? Independent flow of control. Stack

Recap: Thread. What is it? What does it need (thread private)? What for? How to implement? Independent flow of control. Stack What is it? Recap: Thread Independent flow of control What does it need (thread private)? Stack What for? Lightweight programming construct for concurrent activities How to implement? Kernel thread vs.

More information

(MCQZ-CS604 Operating Systems)

(MCQZ-CS604 Operating Systems) command to resume the execution of a suspended job in the foreground fg (Page 68) bg jobs kill commands in Linux is used to copy file is cp (Page 30) mv mkdir The process id returned to the child process

More information

Processes. Process Concept

Processes. Process Concept Processes These slides are created by Dr. Huang of George Mason University. Students registered in Dr. Huang s courses at GMU can make a single machine readable copy and print a single copy of each slide

More information

CS 370 Operating Systems

CS 370 Operating Systems NAME S.ID. # CS 370 Operating Systems Mid-term Example Instructions: The exam time is 50 minutes. CLOSED BOOK. 1. [24 pts] Multiple choice. Check one. a. Multiprogramming is: An executable program that

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

Lecture Topics. Announcements. Today: Threads (Stallings, chapter , 4.6) Next: Concurrency (Stallings, chapter , 5.

Lecture Topics. Announcements. Today: Threads (Stallings, chapter , 4.6) Next: Concurrency (Stallings, chapter , 5. Lecture Topics Today: Threads (Stallings, chapter 4.1-4.3, 4.6) Next: Concurrency (Stallings, chapter 5.1-5.4, 5.7) 1 Announcements Make tutorial Self-Study Exercise #4 Project #2 (due 9/20) Project #3

More information

Processes and More. CSCI 315 Operating Systems Design Department of Computer Science

Processes and More. CSCI 315 Operating Systems Design Department of Computer Science Processes and More CSCI 315 Operating Systems Design Department of Computer Science Notice: The slides for this lecture have been largely based on those accompanying the textbook Operating Systems Concepts,

More information

Starting the System & Basic Erlang Exercises

Starting the System & Basic Erlang Exercises Starting the System & Basic Erlang Exercises These exercises will help you get accustomed with the Erlang development and run time environments. Once you have set up the Erlang mode for emacs, you will

More information

Chair of Software Engineering. Java and C# in depth. Carlo A. Furia, Marco Piccioni, Bertrand Meyer. Java: concurrency

Chair of Software Engineering. Java and C# in depth. Carlo A. Furia, Marco Piccioni, Bertrand Meyer. Java: concurrency Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer Java: concurrency Outline Java threads thread implementation sleep, interrupt, and join threads that return values Thread synchronization

More information

Roadmap. Tevfik Ko!ar. CSC Operating Systems Fall Lecture - III Processes. Louisiana State University. Processes. September 1 st, 2009

Roadmap. Tevfik Ko!ar. CSC Operating Systems Fall Lecture - III Processes. Louisiana State University. Processes. September 1 st, 2009 CSC 4103 - Operating Systems Fall 2009 Lecture - III Processes Tevfik Ko!ar Louisiana State University September 1 st, 2009 1 Roadmap Processes Basic Concepts Process Creation Process Termination Context

More information

Ricardo Rocha. Department of Computer Science Faculty of Sciences University of Porto

Ricardo Rocha. Department of Computer Science Faculty of Sciences University of Porto Ricardo Rocha Department of Computer Science Faculty of Sciences University of Porto Slides based on the book Operating System Concepts, 9th Edition, Abraham Silberschatz, Peter B. Galvin and Greg Gagne,

More information

Mid Term from Feb-2005 to Nov 2012 CS604- Operating System

Mid Term from Feb-2005 to Nov 2012 CS604- Operating System Mid Term from Feb-2005 to Nov 2012 CS604- Operating System Latest Solved from Mid term Papers Resource Person Hina 1-The problem with priority scheduling algorithm is. Deadlock Starvation (Page# 84) Aging

More information

ENGR 3950U / CSCI 3020U UOIT, Fall 2012 Quiz on Process Synchronization SOLUTIONS

ENGR 3950U / CSCI 3020U UOIT, Fall 2012 Quiz on Process Synchronization SOLUTIONS Name: Student Number: SOLUTIONS ENGR 3950U / CSCI 3020U (Operating Systems) Quiz on Process Synchronization November 13, 2012, Duration: 40 Minutes (10 questions and 8 pages, 45 Marks) Instructor: Dr.

More information

Dr. Rafiq Zakaria Campus. Maulana Azad College of Arts, Science & Commerce, Aurangabad. Department of Computer Science. Academic Year

Dr. Rafiq Zakaria Campus. Maulana Azad College of Arts, Science & Commerce, Aurangabad. Department of Computer Science. Academic Year Dr. Rafiq Zakaria Campus Maulana Azad College of Arts, Science & Commerce, Aurangabad Department of Computer Science Academic Year 2015-16 MCQs on Operating System Sem.-II 1.What is operating system? a)

More information

Need for synchronization: If threads comprise parts of our software systems, then they must communicate.

Need for synchronization: If threads comprise parts of our software systems, then they must communicate. Thread communication and synchronization There are two main aspects to Outline for Lecture 19 multithreaded programming in Java: I. Thread synchronization. thread lifecycle, and thread synchronization.

More information

Student: Yu Cheng (Jade) ICS 412 Homework #3 October 07, Explain why a spin-lock is not a good idea on a single processor, single machine.

Student: Yu Cheng (Jade) ICS 412 Homework #3 October 07, Explain why a spin-lock is not a good idea on a single processor, single machine. Student: Yu Cheng (Jade) ICS 412 Homework #3 October 07, 2009 Homework #3 Exercise 1: Explain why a spin-lock is not a good idea on a single processor, single machine. There is a bad side and a good side

More information

Chapter 3: Processes. Operating System Concepts 8 th Edition,

Chapter 3: Processes. Operating System Concepts 8 th Edition, Chapter 3: Processes, Silberschatz, Galvin and Gagne 2009 Chapter 3: Processes Process Concept Process Scheduling Operations on Processes Interprocess Communication 3.2 Silberschatz, Galvin and Gagne 2009

More information

Multitasking Multitasking allows several activities to occur concurrently on the computer. A distinction is usually made between: Process-based multit

Multitasking Multitasking allows several activities to occur concurrently on the computer. A distinction is usually made between: Process-based multit Threads Multitasking Multitasking allows several activities to occur concurrently on the computer. A distinction is usually made between: Process-based multitasking Thread-based multitasking Multitasking

More information

CSC 539: Operating Systems Structure and Design. Spring 2006

CSC 539: Operating Systems Structure and Design. Spring 2006 CSC 539: Operating Systems Structure and Design Spring 2006 Processes and threads process concept process scheduling: state, PCB, process queues, schedulers process operations: create, terminate, wait,

More information

CS2506 Quick Revision

CS2506 Quick Revision CS2506 Quick Revision OS Structure / Layer Kernel Structure Enter Kernel / Trap Instruction Classification of OS Process Definition Process Context Operations Process Management Child Process Thread Process

More information

JAVA and J2EE UNIT - 4 Multithreaded Programming And Event Handling

JAVA and J2EE UNIT - 4 Multithreaded Programming And Event Handling JAVA and J2EE UNIT - 4 Multithreaded Programming And Event Handling Multithreaded Programming Topics Multi Threaded Programming What are threads? How to make the classes threadable; Extending threads;

More information

CHAPTER 2: PROCESS MANAGEMENT

CHAPTER 2: PROCESS MANAGEMENT 1 CHAPTER 2: PROCESS MANAGEMENT Slides by: Ms. Shree Jaswal TOPICS TO BE COVERED Process description: Process, Process States, Process Control Block (PCB), Threads, Thread management. Process Scheduling:

More information

CSC Operating Systems Spring Lecture - XII Midterm Review. Tevfik Ko!ar. Louisiana State University. March 4 th, 2008.

CSC Operating Systems Spring Lecture - XII Midterm Review. Tevfik Ko!ar. Louisiana State University. March 4 th, 2008. CSC 4103 - Operating Systems Spring 2008 Lecture - XII Midterm Review Tevfik Ko!ar Louisiana State University March 4 th, 2008 1 I/O Structure After I/O starts, control returns to user program only upon

More information

REVIEW OF COMMONLY USED DATA STRUCTURES IN OS

REVIEW OF COMMONLY USED DATA STRUCTURES IN OS REVIEW OF COMMONLY USED DATA STRUCTURES IN OS NEEDS FOR EFFICIENT DATA STRUCTURE Storage complexity & Computation complexity matter Consider the problem of scheduling tasks according to their priority

More information

Process Description and Control

Process Description and Control Process Description and Control B.Ramamurthy 1/28/02 B.Ramamurthy 1 Introduction The fundamental task of any operating system is process management. OS must allocate resources to processes, enable sharing

More information

Operating Systems Comprehensive Exam. Spring Student ID # 3/16/2006

Operating Systems Comprehensive Exam. Spring Student ID # 3/16/2006 Operating Systems Comprehensive Exam Spring 2006 Student ID # 3/16/2006 You must complete all of part I (60%) You must complete two of the three sections in part II (20% each) In Part I, circle or select

More information

! The Process Control Block (PCB) " is included in the context,

! The Process Control Block (PCB)  is included in the context, CSE 421/521 - Operating Systems Fall 2012 Lecture - III Processes Tevfik Koşar Roadmap Processes Basic Concepts Process Creation Process Termination Context Switching Process Queues Process Scheduling

More information

Multithreaded Programming

Multithreaded Programming Multithreaded Programming The slides do not contain all the information and cannot be treated as a study material for Operating System. Please refer the text book for exams. September 4, 2014 Topics Overview

More information

Prepared by Prof. Hui Jiang Process. Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University

Prepared by Prof. Hui Jiang Process. Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University EECS3221.3 Operating System Fundamentals No.2 Process Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University How OS manages CPU usage? How CPU is used? Users use CPU to run

More information

Overview. CMSC 330: Organization of Programming Languages. Concurrency. Multiprocessors. Processes vs. Threads. Computation Abstractions

Overview. CMSC 330: Organization of Programming Languages. Concurrency. Multiprocessors. Processes vs. Threads. Computation Abstractions CMSC 330: Organization of Programming Languages Multithreaded Programming Patterns in Java CMSC 330 2 Multiprocessors Description Multiple processing units (multiprocessor) From single microprocessor to

More information

Actor-Based Concurrency: Implementation and Comparative Analysis With Shared Data and Locks Alex Halter Randy Shepherd

Actor-Based Concurrency: Implementation and Comparative Analysis With Shared Data and Locks Alex Halter Randy Shepherd Actor-Based Concurrency: Implementation and Comparative Analysis With Shared Data and Locks Alex Halter Randy Shepherd 1. Introduction Writing correct concurrent programs using shared data and locks is

More information

Process. Prepared by Prof. Hui Jiang Dept. of EECS, York Univ. 1. Process in Memory (I) PROCESS. Process. How OS manages CPU usage? No.

Process. Prepared by Prof. Hui Jiang Dept. of EECS, York Univ. 1. Process in Memory (I) PROCESS. Process. How OS manages CPU usage? No. EECS3221.3 Operating System Fundamentals No.2 Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University How OS manages CPU usage? How CPU is used? Users use CPU to run programs

More information

Performance Throughput Utilization of system resources

Performance Throughput Utilization of system resources Concurrency 1. Why concurrent programming?... 2 2. Evolution... 2 3. Definitions... 3 4. Concurrent languages... 5 5. Problems with concurrency... 6 6. Process Interactions... 7 7. Low-level Concurrency

More information

Processes. Rafael Ramirez Dep Tecnologia Universitat Pompeu Fabra

Processes. Rafael Ramirez Dep Tecnologia Universitat Pompeu Fabra Processes Rafael Ramirez Dep Tecnologia Universitat Pompeu Fabra Processes Process Concept Process Scheduling Operation on Processes Cooperating Processes Interprocess Communication Process Concept Early

More information

SMD149 - Operating Systems

SMD149 - Operating Systems SMD149 - Operating Systems Roland Parviainen November 3, 2005 1 / 45 Outline Overview 2 / 45 Process (tasks) are necessary for concurrency Instance of a program in execution Next invocation of the program

More information

CS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring Lecture 8: Semaphores, Monitors, & Condition Variables

CS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring Lecture 8: Semaphores, Monitors, & Condition Variables CS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring 2004 Lecture 8: Semaphores, Monitors, & Condition Variables 8.0 Main Points: Definition of semaphores Example of use

More information

1 PROCESSES PROCESS CONCEPT The Process Process State Process Control Block 5

1 PROCESSES PROCESS CONCEPT The Process Process State Process Control Block 5 Process Management A process can be thought of as a program in execution. A process will need certain resources such as CPU time, memory, files, and I/O devices to accomplish its task. These resources

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

Reading Assignment 4. n Chapter 4 Threads, due 2/7. 1/31/13 CSE325 - Processes 1

Reading Assignment 4. n Chapter 4 Threads, due 2/7. 1/31/13 CSE325 - Processes 1 Reading Assignment 4 Chapter 4 Threads, due 2/7 1/31/13 CSE325 - Processes 1 What s Next? 1. Process Concept 2. Process Manager Responsibilities 3. Operations on Processes 4. Process Scheduling 5. Cooperating

More information

Operating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst

Operating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst Operating Systems CMPSCI 377 Spring 2017 Mark Corner University of Massachusetts Amherst Clicker Question #1 Program == Process (A) True (B) False Answer on Next Slide The Big Picture So Far Hardware abstraction

More information

Announcements Processes: Part II. Operating Systems. Autumn CS4023

Announcements Processes: Part II. Operating Systems. Autumn CS4023 Operating Systems Autumn 2018-2019 Outline Announcements 1 Announcements 2 Announcements Week04 lab: handin -m cs4023 -p w04 ICT session: Introduction to C programming Outline Announcements 1 Announcements

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

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

PROCESS SYNCHRONIZATION

PROCESS SYNCHRONIZATION PROCESS SYNCHRONIZATION Process Synchronization Background The Critical-Section Problem Peterson s Solution Synchronization Hardware Semaphores Classic Problems of Synchronization Monitors Synchronization

More information

What Is A Process? Process States. Process Concept. Process Control Block (PCB) Process State Transition Diagram 9/6/2013. Process Fundamentals

What Is A Process? Process States. Process Concept. Process Control Block (PCB) Process State Transition Diagram 9/6/2013. Process Fundamentals What Is A Process? A process is a program in execution. Process Fundamentals #include int main(int argc, char*argv[]) { int v; printf( hello world\n ); scanf( %d, &v); return 0; Program test

More information

Lecture 2 Process Management

Lecture 2 Process Management Lecture 2 Process Management Process Concept An operating system executes a variety of programs: Batch system jobs Time-shared systems user programs or tasks The terms job and process may be interchangeable

More information

CS604 - Operating System Solved Subjective Midterm Papers For Midterm Exam Preparation

CS604 - Operating System Solved Subjective Midterm Papers For Midterm Exam Preparation CS604 - Operating System Solved Subjective Midterm Papers For Midterm Exam Preparation The given code is as following; boolean flag[2]; int turn; do { flag[i]=true; turn=j; while(flag[j] && turn==j); critical

More information

CMPSC 311- Introduction to Systems Programming Module: Concurrency

CMPSC 311- Introduction to Systems Programming Module: Concurrency CMPSC 311- Introduction to Systems Programming Module: Concurrency Professor Patrick McDaniel Fall 2013 Sequential Programming Processing a network connection as it arrives and fulfilling the exchange

More information

Processes. Sanzheng Qiao. December, Department of Computing and Software

Processes. Sanzheng Qiao. December, Department of Computing and Software Processes Sanzheng Qiao Department of Computing and Software December, 2012 What is a process? The notion of process is an abstraction. It has been given many definitions. Program in execution is the most

More information

Chapter Machine instruction level 2. High-level language statement level 3. Unit level 4. Program level

Chapter Machine instruction level 2. High-level language statement level 3. Unit level 4. Program level Concurrency can occur at four levels: 1. Machine instruction level 2. High-level language statement level 3. Unit level 4. Program level Because there are no language issues in instruction- and program-level

More information

Problems with Concurrency. February 19, 2014

Problems with Concurrency. February 19, 2014 with Concurrency February 19, 2014 s with concurrency interleavings race conditions dead GUI source of s non-determinism deterministic execution model 2 / 30 General ideas Shared variable Access interleavings

More information

1 Process Coordination

1 Process Coordination COMP 730 (242) Class Notes Section 5: Process Coordination 1 Process Coordination Process coordination consists of synchronization and mutual exclusion, which were discussed earlier. We will now study

More information

CS 431: Introduction to Operating System. Class Note. Introduction to Process Management

CS 431: Introduction to Operating System. Class Note. Introduction to Process Management CS 431: Introduction to Operating System Class Note Introduction to Process Management V Kumar 1 Process Main function of an operating system a. Accept a set of jobs b. Provide them their desired resources

More information

Multicore and Multiprocessor Systems: Part I

Multicore and Multiprocessor Systems: Part I Chapter 3 Multicore and Multiprocessor Systems: Part I Max Planck Institute Magdeburg Jens Saak, Scientific Computing II 44/337 Symmetric Multiprocessing Definition (Symmetric Multiprocessing (SMP)) The

More information

Chapter 3: Processes. Chapter 3: Processes. Process in Memory. Process Concept. Process State. Diagram of Process State

Chapter 3: Processes. Chapter 3: Processes. Process in Memory. Process Concept. Process State. Diagram of Process State Chapter 3: Processes Chapter 3: Processes Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication Communication in Client-Server Systems 3.2 Silberschatz,

More information

Part V. Process Management. Sadeghi, Cubaleska RUB Course Operating System Security Memory Management and Protection

Part V. Process Management. Sadeghi, Cubaleska RUB Course Operating System Security Memory Management and Protection Part V Process Management Sadeghi, Cubaleska RUB 2008-09 Course Operating System Security Memory Management and Protection Roadmap of Chapter 5 Notion of Process and Thread Data Structures Used to Manage

More information

Condition Variables & Semaphores

Condition Variables & Semaphores Condition Variables & Semaphores Nima Honarmand (Based on slides by Prof. Andrea Arpaci-Dusseau) Review: Concurrency Objectives Mutual Exclusion A & B don t run at the same time Solved using locks Ordering

More information

CMPSC 311- Introduction to Systems Programming Module: Concurrency

CMPSC 311- Introduction to Systems Programming Module: Concurrency CMPSC 311- Introduction to Systems Programming Module: Concurrency Professor Patrick McDaniel Fall 2016 Sequential Programming Processing a network connection as it arrives and fulfilling the exchange

More information

Processes. Operating System Concepts with Java. 4.1 Sana a University, Dr aimen

Processes. Operating System Concepts with Java. 4.1 Sana a University, Dr aimen Processes Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication Communication in Client-Server Systems 4.1 Sana a University, Dr aimen Process Concept

More information

UNIT:2. Process Management

UNIT:2. Process Management 1 UNIT:2 Process Management SYLLABUS 2.1 Process and Process management i. Process model overview ii. Programmers view of process iii. Process states 2.2 Process and Processor Scheduling i Scheduling Criteria

More information

Today: Process Management. The Big Picture So Far. What's in a Process? Example Process State in Memory

Today: Process Management. The Big Picture So Far. What's in a Process? Example Process State in Memory The Big Picture So Far Today: Process Management From the Architecture to the OS to the User: Architectural resources, OS management, and User Abstractions. A process as the unit of execution. Hardware

More information

The Big Picture So Far. Today: Process Management

The Big Picture So Far. Today: Process Management The Big Picture So Far From the Architecture to the OS to the User: Architectural resources, OS management, and User Abstractions. Hardware abstraction Processor Memory I/O devices File System Distributed

More information

518 Lecture Notes Week 3

518 Lecture Notes Week 3 518 Lecture Notes Week 3 (Sept. 15, 2014) 1/8 518 Lecture Notes Week 3 1 Topics Process management Process creation with fork() Overlaying an existing process with exec Notes on Lab 3 2 Process management

More information

CS370 Operating Systems Midterm Review

CS370 Operating Systems Midterm Review CS370 Operating Systems Midterm Review Yashwant K Malaiya Fall 2015 Slides based on Text by Silberschatz, Galvin, Gagne 1 1 What is an Operating System? An OS is a program that acts an intermediary between

More information

Concurrent Programming. Copyright 2017 by Robert M. Dondero, Ph.D. Princeton University

Concurrent Programming. Copyright 2017 by Robert M. Dondero, Ph.D. Princeton University Concurrent Programming Copyright 2017 by Robert M. Dondero, Ph.D. Princeton University 1 Objectives You will learn/review: What a process is How to fork and wait for processes What a thread is How to spawn

More information

ANKARA UNIVERSITY COMPUTER ENGINEERING DEPARTMENT BLM334-COM334 PROJECT

ANKARA UNIVERSITY COMPUTER ENGINEERING DEPARTMENT BLM334-COM334 PROJECT ANKARA UNIVERSITY COMPUTER ENGINEERING DEPARTMENT BLM334-COM334 PROJECT Due date: 08.05.2013 Lab Hours You re expected to implement Producer-Consumer Problem that is described below. (Any form of cheating

More information

Part Two - Process Management. Chapter 3: Processes

Part Two - Process Management. Chapter 3: Processes Part Two - Process Management Chapter 3: Processes Chapter 3: Processes 3.1 Process Concept 3.2 Process Scheduling 3.3 Operations on Processes 3.4 Interprocess Communication 3.5 Examples of IPC Systems

More information

Synchronization: semaphores and some more stuff. Operating Systems, Spring 2018, I. Dinur, D. Hendler and R. Iakobashvili

Synchronization: semaphores and some more stuff. Operating Systems, Spring 2018, I. Dinur, D. Hendler and R. Iakobashvili Synchronization: semaphores and some more stuff 1 What's wrong with busy waiting? The mutual exclusion algorithms we saw used busy-waiting. What s wrong with that? Doesn't make sense for uni-processor

More information

B. V. Patel Institute of Business Management, Computer &Information Technology, UTU

B. V. Patel Institute of Business Management, Computer &Information Technology, UTU BCA-3 rd Semester 030010304-Fundamentals Of Operating Systems Unit: 1 Introduction Short Answer Questions : 1. State two ways of process communication. 2. State any two uses of operating system according

More information

Chapter 4: Processes. Process Concept

Chapter 4: Processes. Process Concept Chapter 4: Processes Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication Communication in Client-Server Systems 4.1 Silberschatz, Galvin and Gagne

More information

Synchronization COMPSCI 386

Synchronization COMPSCI 386 Synchronization COMPSCI 386 Obvious? // push an item onto the stack while (top == SIZE) ; stack[top++] = item; // pop an item off the stack while (top == 0) ; item = stack[top--]; PRODUCER CONSUMER Suppose

More information

Operating Systems. II. Processes

Operating Systems. II. Processes Operating Systems II. Processes Ludovic Apvrille ludovic.apvrille@telecom-paristech.fr Eurecom, office 470 http://soc.eurecom.fr/os/ @OS Eurecom Outline Concepts Definitions and basic concepts Process

More information

CS450/550 Operating Systems

CS450/550 Operating Systems CS450/550 Operating Systems Lecture 2 Processes and Threads Dr. Xiaobo Zhou Department of Computer Science CS450/550 P&T.1 Review: Summary of Lecture 1 Two major OS functionalities: machine extension and

More information

UNIX Input/Output Buffering

UNIX Input/Output Buffering UNIX Input/Output Buffering When a C/C++ program begins execution, the operating system environment is responsible for opening three files and providing file pointers to them: stdout standard output stderr

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

CS 350 : COMPUTER SYSTEM CONCEPTS SAMPLE TEST 2 (OPERATING SYSTEMS PART) Student s Name: MAXIMUM MARK: 100 Time allowed: 70 minutes

CS 350 : COMPUTER SYSTEM CONCEPTS SAMPLE TEST 2 (OPERATING SYSTEMS PART) Student s Name: MAXIMUM MARK: 100 Time allowed: 70 minutes CS 350 : COMPUTER SYSTEM CONCEPTS SAMPLE TEST 2 (OPERATING SYSTEMS PART) Student s Name: MAXIMUM MARK: 100 Time allowed: 70 minutes Q1 (30 marks) NOTE: Unless otherwise stated, the questions are with reference

More information

Chapter 4: Processes

Chapter 4: Processes Chapter 4: Processes Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication Communication in Client-Server Systems 4.1 Silberschatz, Galvin and Gagne

More information

Chapter 5: Processes & Process Concept. Objectives. Process Concept Process Scheduling Operations on Processes. Communication in Client-Server Systems

Chapter 5: Processes & Process Concept. Objectives. Process Concept Process Scheduling Operations on Processes. Communication in Client-Server Systems Chapter 5: Processes Chapter 5: Processes & Threads Process Concept Process Scheduling Operations on Processes Interprocess Communication Communication in Client-Server Systems, Silberschatz, Galvin and

More information

Threading and Synchronization. Fahd Albinali

Threading and Synchronization. Fahd Albinali Threading and Synchronization Fahd Albinali Parallelism Parallelism and Pseudoparallelism Why parallelize? Finding parallelism Advantages: better load balancing, better scalability Disadvantages: process/thread

More information

Chapter 3 Processes. Process Concept. Process Concept. Process Concept (Cont.) Process Concept (Cont.) Process Concept (Cont.)

Chapter 3 Processes. Process Concept. Process Concept. Process Concept (Cont.) Process Concept (Cont.) Process Concept (Cont.) Process Concept Chapter 3 Processes Computers can do several activities at a time Executing user programs, reading from disks writing to a printer, etc. In multiprogramming: CPU switches from program to

More information

PYTHON MULTITHREADED PROGRAMMING

PYTHON MULTITHREADED PROGRAMMING PYTHON MULTITHREADED PROGRAMMING http://www.tutorialspoint.com/python/python_multithreading.htm Copyright tutorialspoint.com Running several threads is similar to running several different programs concurrently,

More information

Parallel Programming Languages COMP360

Parallel Programming Languages COMP360 Parallel Programming Languages COMP360 The way the processor industry is going, is to add more and more cores, but nobody knows how to program those things. I mean, two, yeah; four, not really; eight,

More information

Lecture 4: Inter-Process Communication (Jan 27, 2005)

Lecture 4: Inter-Process Communication (Jan 27, 2005) Lecture 4: Inter-Process Communication (Jan 27, 2005) February 17, 2005 1 Review Q: What is the other command that seems to go hand-in-hand with fork()? A: exec* (6 variants of this command) Q: Suppose

More information