Giter Club home page Giter Club logo

mars-os's Introduction

About

This project consists of two parts. The first part is a simulation for the CPU scheduler and the memory manager. The second part is the synchronizer which is a solution for the popular producer-consumer/shared buffer problem.

The 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 with memory allocation capabilities using the buddy memory allocation system.

The synchronizer solves the producer-consumer problem using semaphores and shared memory and supports that multiple producers and multiple consumers can work at the same time.

System Visualization

We used the concept of the β€œtick” in the real OSes. So, we make the scheduler executes every tick which equals to one second. The scheduler supports the follwing algorithms:

  • Round Robin (RR): Every tick the quantum of the running process is decremented. Whenever it finishes its quantum, the scheduler blocks it, puts it in the ready queue (if it still has some work to do and not finished yet), then chooses the next one from the ready queue (if exists) and gives it a full quantum. If the running process finishes before it finishes its quantum, then the scheduler will pick the next process from the ready queue (if exists).
  • Non preemptive Highest Priority First (NHPF): The scheduler chooses the process with the highest priority from the priority queue which has a no complexity of O(1). Then this process runs to completion. At every tick if the scheduler sees that there's no running process, then it chooses the one with the highest priority from the priority queue.
  • Shortest Remaining Time Next (SRTN): The scheduler at any tick chooses the process with the shortest remaining time from the priority queue. This operation has complexity of O(1). At any tick, if a new process arrived with a run time shorter than the running time, it will preempt the running process.

We represented the buddy system by a binary tree and its leaves represent the allocated parts of the memory.

Buddy Visualization

Install

  • You can use Makefile to build and run your project

  • To compile your project, use the command: make

  • To generate a random test case in the scheduler run make generate_test. You can change it as you want in the processes.txt file.

  • To run your project:

    • For the scheduler use the command: make run
    • For the synchronizer use the command: make <name> where name is the producer run_producer or the consumer run_consumer
  • If you added a file to your project add it to the build section in the Makefile

  • Always start the line with a tab in Makefile, it is its syntax

mars-os's People

Contributors

aashrafh avatar mhomran avatar mabobakr avatar aashrafh22 avatar sirsayed98 avatar imgbotapp avatar

Watchers

James Cloos 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.