AUT Operating Systems Lab. course (Fall 2020) resources.
All codes are written in C and tested on Linux kernel version 5.
- Introduction to Linux
- Kernel module programming
- Bash scripting
- IPC (Inter-Process Communication):
- Threads and processes: Distributing computation on multiple processes (and probably multiple cores)
- Process Synchronization (using Pthread mutex locks for synchronization):
- Deadlock: Bankers algorithm
Supports up to MAXGROUP
groups. Each client should join a group with /join
command before sending any messages in the group.
To run the program, compile codes with make all
and then execute the server code and arbitrary number of clients.
./server.out <port>
./client.out <server-address> <port> <client-name>
Supported commands (<group-id>
s are numbers between [0, MAXGROUP
) interval):
/join <group-id>
/send <group-id> <message>
/leave <group-id>
/quit <group-id>
To run the program, execute make run_reader_writer
. It'll be creating 1 instance of writer and READERS
number of reader(s). The writer increments count
variable by one on each iteration up to COUNT_MAX
times.
To run the program, execute make run_dining_philosophers
. It'll be creating 5 instances of philosophers, each one tries to eat EAT_TIMES
times.
Compile the program with make banker
and run it using ./banker.out
. Configure the number of resources and customers by changing NUMBER_OF_RESOURCES
and NUMBER_OF_CUSTOMERS
definitions. Each customer runs for MAX_CUSTOMER_ITERATION
iterations and requests resources randomly on each iteration from the banker. The banker then decides whether to accept the request or rejecting it (to keep the system in a safe state).
The program reads Available matrix
from positional arguments and Max matrix
from MAX_FILE_NAME
file. For instance, the following line initializes code with Available matrix
= [5 6 6 5 5].
./banker.out 5 6 6 5 5
Read the full description (in Persian) here.