CSCI 331 Ch. 2.6

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

pc

program counter

sp

stack pointer

A ______ is an instance of executing a portion of a program within a process without incurring the overhead of creating and managing separate PCBs.

thread

A ________ is a data structure that holds a separate copy of the dynamically changing information necessary for a thread to execute independently.

thread control block (TCB)

The process_state is replicated as a ________ in each TCB. Thus each thread can be running/ready/blocked independently. Other fields (memory, ...) remain in PCB.

thread_state

Advantages of user-level threads (ULTs) over kernel-level threads (KLTs):

Because ULTs do not require any cooperation from the kernel, ULTs are much faster to manage (create, destroy, and schedule) and thus many more can be created than KLTs. Applications using ULTs are portable between different OSs without modifications.

A single-threaded process has one program counter (pc) and one stack pointer (sp) as part of the ______. The process_state may be running, ready, blocked.

CPU_state

The thread library switches between the threads by saving and copying the _______ between the TCBs and the CPU.

CPU_states

With a multi-threaded process, a context switch between threads is performed by the OS kernel. Only with user-level threads. Only with kernel-level threads. Always. Never.

Only with kernel-level threads. With kernel-level threads the kernel manages all TCBs and thus can switch between different threads.

With a multi-threaded process, each TCB maintains a separate copy of the thread state (running, ready, or blocked) but the PCB must also have a copy of the process state (running, ready, or blocked). Only with kernel-level threads. Only with user-level threads. Always. Never.

Only with user-level threads. The kernel is aware of only the PCB, not the individual TCBs, and thus can only keep track of the process state as a whole in the PCB. The individual thread states are manipulated by the thread library independently of the process state.

Main disadvantages of ULTs over KLTs:

ULTs are not visible to the kernel. When one ULT blocks, the entire process blocks, which decreases concurrency and thus the performance and responsiveness of the application. ULTs cannot take advantage of multiple CPUs because the process is perceived by the kernel as a single thread of execution.

In a multi-threaded process the PCB is replaced by multiple TCBs. True False

false A PCB is still needed because much of the information is shared by all threads within the process and need not be replicated in the TCBs.

Memory and other fields are not replicated in the TCBs because the data is not needed by threads. True False

false All fields are needed by threads but all fields other than the CPU_state and thread_state can be shared by all threads.

Using n threads within a single process is more efficient than using n separate processes because _____. only threads can block independently from one another True False

false Both processes and threads can block independently from one another.

Using n threads within a single process is more efficient than using n separate processes because _____. only the threads can take advantage of multiple CPUs True False

false Both processes and threads can take advantage of multiple CPUs.

Each thread accesses the shared code using the private _____. Each thread also has a private stack, accessed using the private sp.

pc

Consequently, the OS _____ is not aware of the threads and treats the process as a single-threaded execution.

kernel

The alternative to user-level threads is to implement threads within the OS _______. The TCBs are not directly accessible to the application, which uses ______ calls to create, destroy, and otherwise manipulate the threads.

kernel

A thread ______ provides functions to create, destroy, schedule, and coordinate threads. It maintains all TCBs within the user process.

library

A process consisting of n ULTs is to be mapped onto a set of m KLTs. Which combination would not fully utilize available resources? n = m > 0 n > m = 1 m > n > 1 n > m > 1

m > n > 1 The n ULTs could not utilize all the m KLTs since each ULT is sequential and thus does not have any concurrent activities that could be mapped on more than one KLT.

Multiple threads within a process _____. will always execute the same sequence of instructions must execute within disjoint parts of the shared program may execute different sequences of instructions within any part of the shared program

may execute different sequences of instructions within any part of the shared program Each thread is an independent entity and can execute any sequence of instruction within the program regardless of any other thread.

Kernel calls are _____ to manage threads. needed only with KLTs needed only with ULTs always needed never needed

needed only with KLTs The only way to access and manipulate TCBs maintained within the kernel is via kernel calls.

The CPU_state is replicated in each TCB, giving each TCB a private _____ and _____.

pc, sp

All threads share the code and global data.

true

Since each thread within a process is an independent execution activity, the runtime information held in the PCB and the execution stack must be replicated for each thread

true

Threads are more efficient to manage than processes

true

Threads can be implemented completely within a user application.

true

With kernel-level threads, the thread management is handled by the kernel using internal thread functions. The application uses kernel calls to request any action.

true

Threads are faster to create and destroy than processes. True False

true A TCB is a much simpler data structure than a PCB and thus is faster to manage.

Using n threads within a single process is more efficient than using n separate processes because _____. the threads share the same code and data True False

true The code and data do not have to be replicated n times.


संबंधित स्टडी सेट्स

MGT 301 Chapter 8: Corporate Diversification

View Set

Chapter 15 The Earth and It's Peoples

View Set

Nurse 250 Final - Quizzes/Kahoot/Math

View Set

Chapter 4: Video Case - Sarbanes-Oxley

View Set

Notes from a Text Review and Quiz Questions

View Set