Presentation is loading. Please wait.

Presentation is loading. Please wait.

Rensselaer Polytechnic Institute CSCI-4210 – Operating Systems David Goldschmidt, Ph.D.

Similar presentations


Presentation on theme: "Rensselaer Polytechnic Institute CSCI-4210 – Operating Systems David Goldschmidt, Ph.D."— Presentation transcript:

1 Rensselaer Polytechnic Institute CSCI-4210 – Operating Systems David Goldschmidt, Ph.D.

2  A process has a single thread of execution  Program execution starts with main()  Program has sole access to data, file descriptors, registers, program stack, program heap, etc.

3  A process has a single thread of execution  One process creates a new process via fork()  Child process has its own resources and its own single thread of execution fork()

4  A process may create additional threads of execution  This is multithreading  Each thread has its own program stack and registers  Do threads share access to data, file descriptors, and other operating system resources?

5  A kernel thread is a thread of execution used by the operating system  Thread management tasks are performed by the operating system  Virtually all modern operating systems support kernel threads

6  A user thread is a thread of execution in an application or other non-kernel program  User threads must be tied to kernel threads  User threads are often provided via APIs:  POSIX Pthreads library (Unix, Mac OS X)  Win32 threads library  Java threads API (managed by each JVM)

7  Many-to-one  User threads are mapped to one kernel thread  Single kernel thread might block all user threads  Support for multiple CPUs?

8  Many-to-many  User threads (m) are mapped to a group of kernel threads (n) ▪ typically with m > n  Single kernel thread will not block all user threads  Support for multiple CPUs?  Some flavors of Unix use this model

9  One-to-one  Each user thread is mapped to a kernel thread  Support for multiple CPUs?  Linux and Windows use this model, though the number of allowed user threads is limited

10  The main() method is executed as a single thread within the Java Virtual Machine (JVM)  Create additional threads by either: ▪ Extending the Thread class ▪ Implementing the Runnable interface  Thread executes via the run() method  But you start a thread by calling start()

11


Download ppt "Rensselaer Polytechnic Institute CSCI-4210 – Operating Systems David Goldschmidt, Ph.D."

Similar presentations


Ads by Google