-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
67 lines (46 loc) · 2.47 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
Redo:
Fixed fork error for more than 18 forked processes, changes are reflected at the Git Repo
Hanzhe Huang
11/08/2021
Project 4
Description:
This program simulates an OSS scheduling processes with a system clock, priority queues and a blocked queue.
Communication between the OSS and user processes are done through messages sent through a message queue.
Each scheduling decision is recorded in the logfile as well as the OSS termination time.
Several statistics are recorded in the console once the OSS finishes parsing through 100 processes.
User Process Constants:
Several constants are defined in "userprocess.c" to determine how often a process is CPU-bound or IO-bound,
as well as whether they are blocked or run for the full duration. A process is more likely to be CPU-bound,
and a process is more likely to be blocked if it's IO-bound.
Chance for a process to be CPU-bound: 70%
Chance for a process to be IO-bound: 30%
Chance for a CPU-bound process to be blocked: 10%
Chance for a IO-bound process to be blocked: 60%
OSS Constants:
Other constants are defined in "oss.c" or "oss.h" to determine how often a new process is created, unblocked and scheduling durations.
Total number of processes to schedule: 100
Max number of processes in CPU: 18
Max time between new processes: 1:50000000 (Seconds:Nanoseconds)
Max time between unblocks: 2:1000
Usage:
./oss [-h] [-s t] [-l f]
Example Usages:
./oss
./oss -s 3 -l logfile
Usage Notes:
[-s]: No termination time is set by default. On my end the program tend to finish within a second unless it parses more than 100 processes.
[-l]: "logfile" is set as the default logfile name if none is given.
Files:
oss.c, oss.h, queue.c, queue.h, structs.h, userprocess.c, makefile, logfile(generated), README
References:
https://www.tutorialspoint.com/inter_process_communication/inter_process_communication_shared_memory.htm
https://stackoverflow.com/questions/19461744/how-to-make-parent-wait-for-all-child-processes-to-finish
https://www.tutorialspoint.com/inter_process_communication/inter_process_communication_message_queues.htm
https://www.geeksforgeeks.org/ipc-using-message-queues/
https://www.gnu.org/software/libc/manual/html_node/Example-of-Getopt.html
http://www.cs.umsl.edu/~sanjiv/classes/cs4760/src/shm.c
https://www.geeksforgeeks.org/signals-c-set-2/
https://www.tutorialspoint.com/c_standard_library/c_function_rand.htm
https://stackoverflow.com/questions/8623131/why-is-rand-not-so-random-after-fork
Git Repository:
https://github.com/hhmz8/PJ4