signal == software interrupt deliverd by OS because
1. a process did something (wrong)
accessed illegal memory read == SIGSEGV(11) , segment violation
divide by zero == SIGFPE(8)
try to execute illegal instructions == SIGILL(4)
process try to write on a pipe that had been shutdown for writing or isn't connected anymore == SIGPIPE(13)
2. a process wants to tell something to another process
to notify that one of its child process ended, so the parent can collect its exit code == SIGCHLD
3. user sends signal to fore ground processes
<Ctrl + C> sends SIGINT(2)
<Ctrl + \> sends SIGQUIT(3)
<Ctrl + Z> sends SIGTSTP(20)
Core action terminate files and also generate core dump file.
default kill command's singal is SIGTERM(15)
SIGKILL(9) , SIGSTOP(19) cannot be catch by process
Trap
$ trap 'echo you can't kill me with <ctrl+c> ' 2 == this means whenever process get signal nubmer 2 instead of terminating it will execute quoted command
Process Scheduling
Linux SVR5 scheduler has 128 priority values 0~49 for kernel 50~127 for user
Classification of process (related to scheduling)
1. interactive process == requires input from either a user, a systems administrator, or in some cases another process running on the computer.
2. batch process == A node with 40 cores at 2.1 GHz is quite a bit “batchier” than a system with 6 cores at 5 GHz. That is, batch tends to be focused, naturally, on throughput rather than latency.
3. real time process == A real time process will preempt all other processes (of lesser scheduling weight) when an interrupt is received and it needs to run.
Classfication of process (related to CPU usage)
1. CPU bound == progresses is limited by the speed of the CPU
2. IO bound == progresses is limited by the speed of the I/O subsystem
nice
priority of process can be recalculated by following formula
priority = base + cpu + nice
base : 0- 127
cpu = Decay rate(1/2) * cpu(i-1) // interval i-1
nice : -20 to +19 == how nice process is going to be to other process.
schedtool
Query and set per process scheduling parameter
1. scheduling policy : 1. real time 2. conventional
1.real time == Round robin , FIFO
2.conventional == SCHED_NORMAL(default) , SCHED_BATCH (cpu intensive jobs) , SCHED_ISO(normally unused) , SCHED_IOLEPRIO (low priority jobs)
2. nice value (-20 to +19)
3. static priority (1 - 99) normally zero
4. cpu affinity ==
process1 was running on cpu0 and context switching happened if os offers hard cpu affinity it can only ,later on , go to cpu0 in order to get better cache performance.
in this case i have affinity 0x1 which means this process can only access cpu0 , if affinity was 0xf process would be able to access 0,1,2,3 cpus
'Operating System > O.S(Arif Butt)' 카테고리의 다른 글
/proc directory , software Installation (Lec12,Lec13) (0) | 2021.01.16 |
---|---|
Task scheduling (Lec13) (0) | 2021.01.14 |
IO Redirection , IPC (Lec8,Lec09) (0) | 2021.01.07 |
Basic Shell Command (Lec06, Lec07) (0) | 2021.01.01 |
Linux Environment (Lec01, Lec02) (0) | 2020.12.29 |