程序代写 COMP 3430 Guderian – cscodehelp代写

Operating Systems
COMP 3430 Guderian

Copyright By cscodehelp代写 加微信 cscodehelp

man 7 signal

Message-passing
Shared memory (hey, that sounds familiar!)

man 7 signal – See standard signals Messages with well-defined meanings we can pass to
Kernel routes messages between processes Sent asynchronously to the process

Default behaviours
Signals for exit, stop, continue….
man 7 signal – See standard signals
Some are catchable, some have non-obvious meanings

“Hangup” – Vestige from actual teletype days Now, used to re-read config files (soft restart)

INT, TERM, KILL

INT, TERM, KILL
SIGINT – By default, stops your program (ctrl-c)

INT, TERM, KILL
SIGINT – By default, stops your program (ctrl-c) SIGTERM – Terminates your program, nicely

INT, TERM, KILL
SIGINT – By default, stops your program (ctrl-c) SIGTERM – Terminates your program, nicely SIGKILL – This stops here, and now. RIP.

SIGUSR1 SIGUSR2
Do… something! These are defined by us.
Simple message-passing (if you only have 2 messages, and they never change)

The untouchables
From man 7 signal:
This is why SIGKILL > SIGTERM
The signals SIGKILL and SIGSTOP cannot be caught,
blocked, or ignored

Sending signals
On a terminal:

Sending signals
On a terminal: Ctrl+C – SIGINT – Interrupt the process

Sending signals
On a terminal:
Ctrl+C – SIGINT – Interrupt the process
Ctrl+ – SIGQUIT – Quit the process (still kindly)

Sending signals
On a terminal:
Ctrl+C – SIGINT – Interrupt the process
Ctrl+ – SIGQUIT – Quit the process (still kindly) Ctrl+Z – SIGTSTP – Stop the process (resumable with SIGCONT)

Terminal command to send signals
man 1 kill
Sends SIGTERM by default
Can send any signal, kill -9 4242…
% kill 4242

C commands for this too

C commands for this too
man 2 kill – odd name, use sigqueue if you hate it

C commands for this too
man 2 kill – odd name, use sigqueue if you hate it
man 3 raise – send a signal to yourself

C commands for this too
man 2 kill – odd name, use sigqueue if you hate it
man 3 raise – send a signal to yourself
Have you seen raise in other languages? Is it similar?

About interrupts
Signals cause interrupts
Running code stops, goes to ‘interrupt handler’ (callback)
Can change values, do anything – can be unsafe!

Check out signal.c

Can we change variables
Or, more importantly…. can we safely change variables?
The signals SIGKILL and SIGSTOP cannot be caught, blocked, or ignored.

程序代写 CS代考 加微信: cscodehelp QQ: 2235208643 Email: kyit630461@163.com

Posted in Uncategorized

Leave a Reply

Your email address will not be published. Required fields are marked *