Process Management Flashcards
Succinctly describe a process.
A unit of resource allocation.
Succinctly describe a thread.
A unit of execution.
What’s a major difference between a process and a thread?
(Many answers)
Processes are collections of one or more threads.
Processes have a PID; Threads have associated variables.
Processes have Virtual Memory dedicated to them; Threads share memory (by def’n).
What’s the C command for getting a process ID?
getpid(void). Returns a pid_t.
What’s the C command for creating a thread?
pthread_create(pthread_t& thread, <attr.s>, void* thread_fn, void* arg);</attr.s>
What is a signal?
A special event delivered to a process (or many).
How can I call a signal?
sighandler_t signal(int signum, sighandler_t handler);
What makes signals distinct from hardware interrupts?
Signals are handled by the OS, and may go through many handlers. Hardware interrupts touch hardware.
What is polling?
The process of actively checking for events (signals, interrupts) at regular intervals.
What is Reentrant & Thread-Safe Code?
Code that allows for calling when it’s already running. Does not modify global or static variables, and only uses its own arguments and local variables.
What is Parallelism?
The process of running multiple threads at the same time using dedicated hardware resources.
What is Concurrency?
The process of running multiple threads at the same time using shared hardware resources.
What’s the major difference between Parallelism and Concurrency?
Parallelism is guaranteed to utilize simultaneous execution; Concurrency merely imitates it.
Why is multithreading effective?
Multi-core systems.
TRUE/FALSE: Threads have their own address spaces.
FALSE: Threads share the same address space in order to access the heap, any global variables, etc.