https://github.com/devstein/timer-shell
Basic shell that kills process that take too long
https://github.com/devstein/timer-shell
Last synced: 23 days ago
JSON representation
Basic shell that kills process that take too long
- Host: GitHub
- URL: https://github.com/devstein/timer-shell
- Owner: devstein
- Created: 2016-09-15T00:35:13.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-09-15T23:51:32.000Z (over 9 years ago)
- Last Synced: 2025-11-29T09:03:47.040Z (6 months ago)
- Language: C
- Homepage:
- Size: 14.6 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 380Project0
1pt Extra Credit:
What does the man page have to say about mixing calls to sleep(3) and alarm(2)? Answer this
question in your README: it should include a sample program.
The man page says that mxining calls to sleep(3) and alarm(2) are a bad idea. The scheduling delays can cause the execution of the process to be delayed by an arbitrary amount of time.
For example imagine setting an alarm for 5 seconds, but then sleeping for 10 seconds. The alarm will go off after 5 seconds even though the program was suppose to sleep for 10.
int main(){
signal(SIGALRM, handler)
alarm(5);
sleep(10);
}
What other signal(s) have this property? Which signals will terminate the program if unhandled? Which man page has this information?
SIGSTOP and SIGKILL cannot be ignored as explained by the signal(2) man page.