MULTITHREADING MODEL o Process:Operating system abstraction to code data files represent what is needed to run a single, registers registers registers multithreaded program o Two parts: stack stack stack Multiple Threads o Each thread is a single, sequential stream of execution 3 thread Protected Resources: o Main Memory State (contents of Address Space) oI/O state (i.e.file descriptors) multithreaded process
MULTITHREADING MODEL Process: Operating system abstraction to represent what is needed to run a single, multithreaded program Two parts: Multiple Threads Each thread is a single, sequential stream of execution Protected Resources: Main Memory State (contents of Address Space) I/O state (i.e. file descriptors)
BENEFITS o Responsiveness o Resource Sharing o Economy o Utilization of MP Architectures
BENEFITS Responsiveness Resource Sharing Economy Utilization of MP Architectures
SINGLE AND MULTITHREADED PROCESSES code data files code data files registers stack registers registers registers stack stack stack thread 3 thread single-threaded process multithreaded process Why separate the concept of a thread from that of a process? Discuss the "thread"part of a process (concurrency) Separate from the "address space"(Protection) Heavyweight Process Process with one thread
SINGLE AND MULTITHREADED PROCESSES Why separate the concept of a thread from that of a process? • Discuss the “thread” part of a process (concurrency) • Separate from the “address space” (Protection) • Heavyweight Process Process with one thread
THE RELATIONSHIP BETWEEN THREAD AND PROCESS o Thread is based on the process o Thread is belong to the process o Difference: contents oThread:PC,stack,registers,status... o Process:address space,global variables,open files,signal... dependency o Thread:can not live independently,belong to the process o Process:can be independent protection o Thread:no protection between the threads in a process o Process:has protection.One process can not access another process's address space
THE RELATIONSHIP BETWEEN THREAD AND PROCESS Thread is based on the process Thread is belong to the process Difference: contents Thread: PC, stack, registers, status… Process: address space, global variables, open files, signal… dependency Thread: can not live independently, belong to the process Process: can be independent protection Thread: no protection between the threads in a process Process: has protection. One process can not access another process’s address space
N One Many threads Per AS: One MS/DOS,early Macintosh Traditional UNIX Embedded systems Mach,OS/2,Linux, (Geoworks,VxWorks, Many Win 95?,Mac OS X, JavaOs,etc) Win NT to XP,Solaris, JavaOs,Pilot(PC) HP-UX o Real operating systems have either One or many address spaces One or many threads per address space o Did Windows 95/98/ME have real memory protection? No:Users could overwrite process tables/System DLLs
CLASSIFICATIO N Real operating systems have either One or many address spaces One or many threads per address space Did Windows 95/98/ME have real memory protection? No: Users could overwrite process tables/System DLLs Mach, OS/2, Linux, Win 95?, Mac OS X, Win NT to XP, Solaris, HP-UX Embedded systems (Geoworks, VxWorks, JavaOS,etc) JavaOS, Pilot(PC) Traditional UNIX MS/DOS, early Macintosh Many One # threads Per AS: One Many # of addr spaces: