Skip to content

pavlosdais/Operating-Systems

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Operating Systems Assignments

A simulation of a voting procedure where different data structures are used in order to maintain an order regarding the voters, and be able to perform (almost all) queries in constant time.

The following data structures are used:

to store all the info regarding the voting process.

The queries include adding voters and printing information about the voting process.

Implemention of 2 sorting algorithms {quicksort & heapsort}, that work as separate processes from the rest of the program. The algorithms are used to sort a file containing records using the following hierarchy:

  1. Coordinator

    The coordinator is responsible for creating the splitters. After the splitters are finished, it receives the records then finally merges them to create the final, sorted file.

  2. Splitter

    The splitter is responsible for creating the sorters. After the sorters are finished, it receives the records then merges them. It then passes the records up to the coordinator.

  3. Sorter (quicksort & heapsort)

    The sorter is responsible for sorting a particular part of a file then passing the records up to the splitter.

The processes communicate via pipes, by passing the different flags and records needed for the sorting.

A simulation of the readers - writers problem using records from a banking customers file. The "unique" and challenging part of the assignment though, is that we can allow multiple of writers/readers to read/write at the file, at the same time. This is done in a fair & starve-free way, by enforcing a First In First Out (FIFO) system for all processes. In short, the processes follow the following protocol:

  1. Reader

The reader before entering to read a range of records, checks for potential writers that block its range. It saves the number of such writers, and if it is more than one it waits. Otherwise it reads.

The reader after exiting checks for potential writers that it blocked (because it was reading). For every such writer, it decrements the number of readers its blocked by. If its 0, it wakes up.

  1. Writer

The writer before entering to write a record at a specific index, checks for potential processes (readers/writers) that block it. It saves the number of such processes, and if it is more than one it waits. Otherwise, it writes.

The writer after exiting checks for potential processes that it blocked (because it was writing). For every such process, it decrements the number of writers its blocked by. If its 0, it wakes up.

A logging system has also been implemented to ensure the correctness of the synchronization.

A UNIX command that allows us to (efficiently)

  1. Compare or
  2. Merge

two different directories.

The command works with:

  • Regular files
  • Directories
  • Soft links
  • Hard links

The assignment was completed in collaboration with Aristarchos Kaloutas.

About

The programming projects were created for the Operating Systems - K22 course under prof. Alex Delis. Each assignment got a score of 100/100.