source: liacs/os/assignment3/README@ 91

Last change on this file since 91 was 2, checked in by Rick van der Zwet, 15 years ago

Initial import of data of old repository ('data') worth keeping (e.g. tracking
means of URL access statistics)

File size: 3.4 KB
Line 
1# Rick van der Zwet
2# 0433373
3# OS Assigment 3
4# Licence: BSD
5# $Id: README.txt 508 2008-03-02 14:18:40Z rick $
6
7
8= Intro =
9File compiled on mac os x, gcc 4.0.1
10
11
12= Files =
13Makefile = Makefile to generate executables of C code
14assignment3.c = Source code part A
15README.txt = Currently reading
16
17
18= Output part A =
19* Describe what this program does.
20# Creates handler for the signals SIGUSR1 and SIGUSR2
21# Fork program to create child
22# Program main signals child, but as the handler is bound to the main
23# program it got received the parent itself
24# Child signals parent which is received by parent
25# Child returned
26
27* Change line 59 so it also sends SIGUSR1. What happens to the program's
28 output?
29# SIGUSR1 is only received ones
30While still busy handling the first requests. All signals are
31blocked/ignored. Also see `man 2 sigaction` par 4
32
33* Try removing the sleep statement from line 51,61 or both. Are both
34 these sleep statements required?
35Disabling one or 2 sleep states does not change the program dehaviour on
36mac os x.
37
38NOTE: When adding a sleep statement in front of the line 58:
39kill(child_pid, SIGUSR1); the whole behaviour changes. It seems that the
40handlers are created shortly after the fork has been completed. I also
41build the code on a linux system with gcc 4.1.2 and all results changed.
42
43Removing the first sleep statements kill the calls from parent to child.
44Removing the second sleep statement does not change anything.
45Removing both will kill the call from parent to child.
46
47= Output part B =
48Code is to be found at nutt-lab-6-1.c. Rather verbose, lots of duplicate
49code lines, but working
50
51
52
53Calculating fibonacci number: 20
54
55Child 1 fib = 6765, real time = 0 sec, 0 msec
56Child 1 fib = 6765, cpu time = 0 sec, 1 msec
57Child 1 fib = 6765, user time = 0 sec, 1 msec
58Child 1 fib = 6765, kernel time = 0 sec, 0 msec
59
60Child 2 fib = 6765, real time = 0 sec, 999 msec
61Child 2 fib = 6765, cpu time = 0 sec, 1 msec
62Child 2 fib = 6765, user time = 0 sec, 1 msec
63Child 2 fib = 6765, kernel time = 0 sec, 0 msec
64
65Parent fib = 6765, real time = 0 sec, 982 msec
66Parent fib = 6765, cpu time = 0 sec, 1 msec
67Parent fib = 6765, user time = 0 sec, 1 msec
68Parent fib = 6765, kernel time = 0 sec, 0 msec
69
70Calculating fibonacci number: 30
71
72Child 1 fib = 832040, real time = 0 sec, 0 msec
73Child 1 fib = 832040, cpu time = 0 sec, 1 msec
74Child 1 fib = 832040, user time = 0 sec, 1 msec
75Child 1 fib = 832040, kernel time = 0 sec, 0 msec
76
77Child 2 fib = 832040, real time = 0 sec, 980 msec
78Child 2 fib = 832040, cpu time = 0 sec, 980 msec
79Child 2 fib = 832040, user time = 0 sec, 980 msec
80Child 2 fib = 832040, kernel time = 0 sec, 0 msec
81
82Parent fib = 832040, real time = 0 sec, 961 msec
83Parent fib = 832040, cpu time = 0 sec, 980 msec
84Parent fib = 832040, user time = 0 sec, 980 msec
85Parent fib = 832040, kernel time = 0 sec, 0 msec
86
87Calculating fibonacci number: 36
88
89Child 2 fib = 14930352, real time = 0 sec, 558 msec
90Child 2 fib = 14930352, cpu time = 0 sec, 820 msec
91Child 2 fib = 14930352, user time = 0 sec, 820 msec
92Child 2 fib = 14930352, kernel time = 0 sec, 0 msec
93
94Child 1 fib = 14930352, real time = 0 sec, 0 msec
95Child 1 fib = 14930352, cpu time = 0 sec, 0 msec
96Child 1 fib = 14930352, user time = 0 sec, 0 msec
97Child 1 fib = 14930352, kernel time = 0 sec, 0 msec
98
99Parent fib = 14930352, real time = 0 sec, 545 msec
100Parent fib = 14930352, cpu time = 0 sec, 830 msec
101Parent fib = 14930352, user time = 0 sec, 830 msec
102Parent fib = 14930352, kernel time = 0 sec, 0 msec
Note: See TracBrowser for help on using the repository browser.