Giter Club home page Giter Club logo

multiple-processes-sorter's Introduction

Multiple Processes Sorter

A program sorting a binary file of records in various ways using multiple processes.
The main goal of this program implementation was to practice with fork, exec, piping and sigaction.

Received statistics about turnaround time of processes and signals are printed at the end of the program execution.

Process Tree

Here's how the process tree looks like when making full use of the executables: coordinator, coaches and sorters processes

Compilation

$ make clean

$ make

Usage

Command Line Parameters (and their flags) can be used in any order.

Command Line Flags h,q are optional and can be used up to 4 times. On the other hand, Command Line Flag f is required.

./mysort -f <Input File> -h|q <Column ID> [-h|q <Column ID>]

Design Decisions

  • Each Record is represented by a simple struct of its data.

  • Coordinator node is represented by mysort executable. Coordinator node can fork and exec coach nodes according to the tree of processes shown above.

  • Coach nodes are represented by coach0, coach1, coach2 or coach3 executables. Coach nodes can fork and exec sorter nodes according to the tree of processes shown above.

  • Sorter nodes are represented by heapsorter or quicksorter executables.

Implementation / Interface

  • Struct to define a record: records/record.c, records/record.h

  • Header file with important definitions: defines.h

  • Main function for Heapsort sorter: sorters/heapsorter.c

  • Main function for Quicksort sorter: sorters/quicksorter.c

  • Main function for coach with 2^0 = 1 sorter as child process: coaches/coach0.c

  • Main function for coach with 2^1 = 2 sorters as child processes: coaches/coach1.c

  • Main function for coach with 2^2 = 4 sorters as child processes: coaches/coach2.c

  • Main function for coach with 2^3 = 8 sorters as child processes: coaches/coach3.c

  • Main function for coordinator of 1 up to 4 coaches: coordinator.c

Format of Records in Output Files

The records in output files are printed in the following form:

regNumber name surname houseStreet houseNumber city postcode salary

multiple-processes-sorter's People

Contributors

efsiatras avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.