Threads(cont Multithreading(cont Each thread has a thread execution state(running, ready, etc. a separate control block, with priority, some thread related state information, and saved processor context when not running (with program counter an execution stack some per-thread static storage for local variables access to the memory and resources of its process, shared with all other threads in the process A single application logically doing several functions especially in GUI systems Example application-a file server entertaining requests to create, open, read and write on files >>One thread per request Two threads cannot write on the same file at the same time5 Threads (cont.) – Multithreading (cont.) • Each thread has – a thread execution state (running, ready, etc.) – a separate control block, with priority, some thread related state information, and saved processor context when not running (with program counter) – an execution stack – some per-thread static storage for local variables – access to the memory and resources of its process, shared with all other threads in the process, • A single application logically doing several functions, especially in GUI systems. – Example application -- a file server entertaining requests to create, open, read, and write on files. »One thread per request »Two threads cannot write on the same file at the same time