Process Management (week 5) Flashcards
what is a program
a program is a binary program in execution
what is a process made up of
a binary program
data on which the program will execute
resources required for execution, including the files, devices which contain or provides the data required
–> some examples are CPU time, input-output devices, files, etc
multiple processes can be generated from _________
1 program file
for example you can only have one browser program but you can have multiple processes running in that program (opening multiple windows)
true or false
process also contains memory stack space
true
how many threads in 1 process are there in the classic process design
one as there is only one execution engine per process
how many threads in 1 process are there in the modern computer
multiple threads as there is multiple execution engines per process
threads can be thought of as
subprocesses
Describe what is a thread
a thread is a single execution engine capable of performing a series of instructions in a computer program
In a multiple threaded process, each thread needs to maintain its own set of data in order to perform its own series of instructions.
what is an example of threads
A word processor may have a thread for
–> displaying graphics,
–> another thread for responding to keystrokes from user
–>third for performing spelling and grammar checking in the background
where is thread specific data stored
Thread specific data is private to the thread. This data is usually stored in a stack.
thread specific data includes:
–> Program counter
–> Status of thread
–> processor registers
–> stack space
threads within the same process share ?
–> Program code
–> Data
–> Resources
threads are also called
lightweight processes
in unix process, OS kernel creates a _____________ to
manage process
process descriptor
in unix process, what is process identifier
it is the User handle for the process (descriptor)
what does the linux command ps -aux display
list of all the processes running on your system
how will the os create a new process in the windows NT model
user program makes a system call to request to the kernel to activate the create process function
all this must happen in supervisor mode and not user mode
benefits of multithreaded process
–> more responsive
–> resource sharing (easier for the os to allocate resources to each process and the process will further allocate to the threads)
–> ease of memory and resource allocation
–> utilization of multiprocessor architectures
what is a process manager
To manage multiple processes, modern OS
implement the process manager to manage the
processes.
what does the process manager implement
–> Calls like fork() in UNIX and CreateProcess() in
windows to create processes.
–> Calls like pthread_create() in Linux and
CreateThread() in Windows to support threading.
–> Calls like close() in Unix and CloseHandle() in
Windows to close processes/threads to release
resources.
what are the responsibilities of the process manager
–> Define & implement the essential characteristics of a
process and thread
–> Algorithms to define the behavior
–> Data structures to preserve the state of the execution
–> Define what “things” threads in the process can
reference – the address space (most of the “things”
are memory locations)
–> Manage the resources used by the processes/threads
–> Tools to create/destroy/manipulate processes & threads —-> Tools to schedule the processes on the CPU.
–> Tools to allow threads to synchronize the operation with one another.
–> Mechanisms to handle deadlock.
–> Mechanisms to handle protection.
what information does the process descriptor store
–> Process ID
–> Program counter
–> Register values
–> Process state
–> Type & location of resources it holds
–> List of resources it needs
–> Security keys
process descriptor is also called
process control block (PCB)
what is a context
In a multiple process environment, each
thread of execution is a context
what is a context switch
a context switch happens when the CPU switches between two processes/threads
when can the context switch occur
A context switch can only occur when the
OS gets control of the CPU through traps
or interrupts (happens when os gets access to CPU by switching to supervisor)
what is running state
: Instructions are being executed
what is Blocked state
The process is waiting for some event to
occur (eg, I/O completion)
what is Ready state
The process is waiting to be assigned to a
processor.
what is done state
The process has finished execution
true or false
Modern OS implements additional states as
required to support more complex features.
true