-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.txt
64 lines (49 loc) · 3.23 KB
/
README.txt
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
Name : Shashank Pal
Student ID : 2021H1030064G
-----------------------------------------------------------------------------------------------------------------------
List of Directories :
assignment_2 : It houses all the files related to this assignment.
assignment_2/src : It contains all the needed source and header files.
-----------------------------------------------------------------------------------------------------------------------
List of Files :
All source and header files are included in directory assignment_2/src :
scheduler.c : It creates n (total no. of teams) processes. Reads the schedules from the file and schedules
them by giving signal to these processes.
manager.c : I'm taking manager, team and stadium as a single entity. As making them different didn't make sense and
also question didn't ask for it specifically. This file simualte the match and updates the result.
queue.c & queue.h: File containing the code for data structure queue. (Used library from https://github.com/kostakis/Generic-Queue)
implementation.c : Contains all the implementations of different functions used.
project.h : Simple header file indicating what #includes are used,
what functions and custom data structures that I'm using.
And , what are the pre and post conditions of a particular function.
-----------------------------------------------------------------------------------------------------------------------
HOW TO COMPILE :
First : cd/assignment_2
Then run : make clean (to remove any unnecessary object and executable files)
Lastly run : make
-----------------------------------------------------------------------------------------------------------------------
HOW TO RUN :
First make sure you're in /assignment_2 directory.
Then to run program, type following with required amount of arguments : ./output (path of a file)
For ex : ./output src/fixtures.txt
-----------------------------------------------------------------------------------------------------------------------
Description Of The Structure Of My Program :
- First by running ./output (path of a a file) we start scheduler.c.
- Then scheduler.c sets up the shared memory and that our program will use.
Will read the schedules from the file given in the argument and store it in a queue.
Will loop until queue becomes empty and gives signal to the process which has to simulate the match.
After all the schedules have been completed, it will terminate all the running processes.
Will create the table from the result that is stored in the shared memory.
Then, it will sort the table and print it. (Used selection sort)
(I've used named Shared Memory from POSIX interface.)
- Manager.c will link itself to the shared memory
Will simulate the match using rand() and sleep.
After simulation , updates the result into the shared memory.
And exit.
- After printing of final table ,
scheduler.c will unlink the shared memory.
And exit.
-----------------------------------------------------------------------------------------------------------------------
BUGS :
None (To my limited knowledge)
-----------------------------------------------------------------------------------------------------------------------