Lecture Operating system principles - Chapter 4: Threads

This chapter examines some more advanced concepts related to process management, which are found in a number of contemporary operating systems. We show that the concept of process is more complex and subtle than presented so far and in fact embodies two separate and potentially independent concepts: one relating to resource ownership and another relating to execution. | Chapter 4 Threads Threads: Resource ownership and execution Processes and Threads Processes have two characteristics: Resource ownership – a process includes an address space to hold the process image and may be allocated control or ownership of resources Scheduling/execution – process execution follows an execution path that may be interleaved with other processes These two characteristics are treated independently by the operating system Processes and Threads The unit of dispatching is referred to as a thread or lightweight process The unit of resource ownership is referred to as a process or task Multithreading The ability of an OS to support multiple, concurrent paths of execution within a single process. Single Thread Approaches MS-DOS supports a single user process and a single thread Some UNIX, support multiple user processes but only support one thread per process Multithreading Java run-time environment is a single process with multiple threads Multiple . | Chapter 4 Threads Threads: Resource ownership and execution Processes and Threads Processes have two characteristics: Resource ownership – a process includes an address space to hold the process image and may be allocated control or ownership of resources Scheduling/execution – process execution follows an execution path that may be interleaved with other processes These two characteristics are treated independently by the operating system Processes and Threads The unit of dispatching is referred to as a thread or lightweight process The unit of resource ownership is referred to as a process or task Multithreading The ability of an OS to support multiple, concurrent paths of execution within a single process. Single Thread Approaches MS-DOS supports a single user process and a single thread Some UNIX, support multiple user processes but only support one thread per process Multithreading Java run-time environment is a single process with multiple threads Multiple processes and threads are found in Windows, Solaris, and many modern versions of UNIX Processes In a multithreaded environment, a process is defined as a unit of resource allocation: a virtual address space which holds the process image a unit of protection: protected access to processors, other processes (for IPC), files, I/O resources One or More Threads in Process Each thread has An execution state (running, ready, etc.) Saved thread context when not running An execution stack Some per-thread static storage for local variables Access to the memory and resources of its process (all threads of a process share this) One view One way to view a thread is as an independent program counter operating within a process. Threads vs. processes Threads vs. processes The thread control block contains register values, priority, and other thread-related state information. All threads of a process share the state and resources of that process. reside in the same address space have .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.