Giter VIP home page Giter VIP logo

os's Introduction

70 point project -- Pre-emptive OS

Team: 
1. Karthik Reddy (109721778)
2. Sree Harsha Subraveti (109748906)
3. Pavan Maguluri (109892313)

NOTE
=======
1. Maximum 30000 processes.
2. Each process can have 16 open files.
3. All processes combined can have 100 open files
4. Maximum characeters in a file path is 100 bytes.
5. Maximum size of each individual argv/envp is 200 bytes.
6. SCANF BLOCKS UNTIL LINE FEED I.E., CHARACTERS TERMINATED BY '\n'.
7. Process which issues scanf first is considered as foreground process and any other process issuing scanf is killed.
8. There are three processes to begin with 
   pid 	 process
   1	 initproc		->		frees orphaned zombies
   2 	 idle process		
   3 	 sbush			->		loads shell
   Do not kill any of these three.
9. FOREGROUND - BACKGROUND

    BG and FG processes will be reaped by parent during waitpid, if not process will become a zombie. If the zombie's parent exits, it makes initproc the parent of all its children. Initproc sits in an infinite waitpid loop, reaping zombies

   BACKGROUND
   ==========
   Shell forks a background process when given with an '&' at the end of statement and returns immedialtely for next input. Does not wait for background proc.
   		 a. Background procs will fork only more background procs
		 b. Background procs will be terminated when they attempt to use STDIN
		 c. Background proc will be reaped by parent during waitpid, if not background proc will become a zombie.
		    If the zombie's parent exits, it makes initproc the parent of all its children. Initproc sits in an infinite waitpid loop, reaping zombies
   FOREGROUND
   ==========
		a. Shell forks a foreground process and waitsfor the foreground child to exit.
		   During this wait it may reap some zombie background child processes but will continue to wait for foreground child.
		b. When a foreground process forks a child, the child will become the new foreground process.
		   Only it is allowed to read STDIN. Anyother process attempting to read STDIN will be killed.
		   Once the forefround child, dies its parent gets to be the foreground process.

10. Available binaries -- ps, kill -9 <pid>, sleep <secs>, echo <string>, echo $PATH, ls [<path>]

SBUSH MANUAL
============
Path functionality
command our sbush supports: set PATH <give a path>
case1: set PATH $PATH:/usr/bin/abc -> this command appends /usr/bin/abc to the existing path
case2: set PATH /usr/bin/abc:$PATH -> this command prepends /usr/bin/abc to the existing path
case3: set PATH /usr/bin/abc -> this command removes the existing path and sets to /usr/bin/abc
case4: set PATH $PATH -> this command prints the current PATH

PS1 functionality
command our sbush supports: set PS1 "<give a word>"
example: set PS1 "sbush$ " -> this command changes the prompt to sbush$ 
example: set PS1 sbush$ -> this command throws an error

Pipe functionality
command our sbush supports: <command1> [args]|<command2> [args][|<command3> [args]] 
example: ls | head | tail
example: /bin/ls | head | tail 
example: ls -a -l  | head -3  |   tail -1

EXECUTE BINARY functionality
syntax 1:
        <filepath>
	If given input is a path(i.e contains '/') then it executes given filepath.
	If given input is just a filename(i.e no '/') then shell searches for given filename in every PATH dir and tries to execute
	example: sbush-shell$ rootfs/bin/sbush -> since input is a path, shell executes the given filepath.
	example: sbush-shell$ ls -> looks up ls in every path directory and executes it, if found.

EXECUTE SCRIPT functionality
syntax 1:
       Include the following line as the first line of the script
       #! /bin/sbush
       example: bash-shell$ ./script.sh -> Can be run from outside our shell(sbush) as well
       example: sbush-shell$ ./script.sh -> can be given interactively within shell. Please note that it should be a filepath and not just a filename.

NOTE: file CAN BE ANY extension.

LS functionality
syntax 1:
	/bin/ls <directory path 1> <directory path 2> ...
	example: /bin/ls ..
	Prints contents of specified directories
syntax 2:
       /bin/ls
       Prints contents of current working directory by default
NOTE: This is implemented to test our stdlib.h. 

===========================================================

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.