chapter 2 Flashcards
what is a virtual processor?
is a simulated processor built on top of the physical processor by the OS
what is a processor?
provides instructions along with the capability to execute them
what is a thread?
a single path of execution in a process. a process can contain multiple threads
what is a process?
a program in execution that can execute 1 or more threads
what are benefits of multithreading?
- hides network latencies [ program executes d/t thread when a thread blocks when ]
- resource sharing
what things is a process made up of?
- pid
- pc
- 1 executing program
- memory
- signal handlers
how is pid determined?
A process can determine:
- its own pid - pid_t getpid (void);
- pid of its parents - pid_t getppid (void);
how is pid determined?
A process can determine:
- its own pid - pid_t getpid (void);
- pid of its parents - pid_t getppid (void);
how is a process created?
only by another process
how can we differentiate between a parent and child process?
fork() returns:
- 0 to the child
- pid of child to parent
- -1 if error occurs
what does fork() do?
creates a child that is the exact copy of parent process, and hence executes the same program
what does exec() do?
allows a process to switch execution to a d/t program
when does a process stop?
- when the main() function returns
- when a program calls exit()
how can a process stop another process?
- by sending a signal to it
- SIGINT stops a process (ctrl + c)
what does a signal do?
notifies a process that a particular event has occurred
list some examples of signals.
SIG:
- SEGV - seg fault
- BUS - bus error
- PIPE - trying to write to a disconnected pipe
- CHLD - child process has stopped
- USR1, USR2 - generic signal used by user programs
why can’t processes influence eachother?
they are executed in isolation from each other
why can’t processes influence eachother?
they are executed in isolation from each other