Giter Site home page Giter Site logo

os_proj's Introduction

GitHub contributors GitHub issues GitHub forks GitHub stars GitHub license

Table of Contents

About The Project

A CPU scheduler determines an order for the execution of its scheduled processes; it decides which process will run according to a certain data structure that keeps track of the processes in the system and their status.
A process, upon creation, has one of the three states: Running, Ready, Blocked (doing I/O, using other resources than CPU or waiting on unavailable resource).
OS for 1 CPU and fixed memory size 1024 byte

System Diagram

Data structures used

  • LinkedList for storing processes and memory free list.
  • Dynamic array (vector) for storing weighted turnaround time.

Algorithm description

The process generator readsinput,initiate and create the scheduler and clock processes.
The scheduler communicates with the process generator through 2 semaphores and message queues.
Whenever the process generator finishes it sends a message to the scheduler and busy waits till it’s killed.
The scheduler forksthe process and, for phase 2, allocates its memoryFor phase 2, We store the memory free list in an array with size 11 memory segments from 2^0 to 2^10, every index in the free list is a linked list ofsorted allocated memory segmentsTheprocessupdatesitsremaining time and stores it in a shared memoryso thescheduler can access it .Every one clock Scheduler takes the lead and pause the running process with semaphores .Every one clock Scheduler receives the data from Process generator, updates the running process PCB, decides to stop the running process and start other one or not according to the selected algorithm (RR, SRTN, HPF) Thescheduler will remove the process from the queue and, for phase 2, deallocate the memory used by this processwhenthe remaining time of the process is zero.

  • Assumptions :
    • No process can arrive at 0 (this causes inconsistency as the program requires time to initialize)
    • In phase 2 RR, If a process cannot be allocated (insufficient memory) it proceeds to the next process and if it is at the end it wraps around.
    • In phase 2, If 2 or more processes have the same everything except memory size it does NOT get sorted by the memory size. We just get the same order of the process generator.
    • The compiled programs is .out (not .o). it matters as we are calling them by name in the code.
      You can use this snippet for compiling the program.
      PS: the -lm argument while compiling scheduler is necessary.
    gcc process_generator.c -o process_generator.out
    gcc clk.c -o clk.out
    gcc scheduler.c -lm -o scheduler.out
    gcc process.c -o process.out 

Installation

  1. Clone the repository
$ git clone https://github.com/D4rk1n/OS_Proj
  1. Navigate to repository directory
$ cd OS_Proj

Running

run ./process_generator.out-h to see explanation of the arguments

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b AmazingFeature-Feat)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin AmazingFeature-Feat)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contributers


Abdelrahman Tarek


Hassan Mohamed


Abdelrahman Arafat


Aly Abozied

os_proj's People

Contributors

fuboki10 avatar hassan950 avatar aaarafat avatar alyabozied 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.