Skip to content

Codes aggregated and corrected by S Sreeram. The repository belongs to him.

Notifications You must be signed in to change notification settings

blackpeps/oslab2023exam

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Operating System Lab (CSL204)

Table of Contents

Experiments/Programs Code Download PDF
01 - Familiarisation of Linux Commands No Code Download
02 - Shell Programming Check Subsection Download
03 - System Calls Check Subsection Download
04 - I/O System Calls Code Download
05 - Scheduling Algorithms Check Subsection Download
06 - Inter Process Communication using Shared Memory Check Subsection Download
07 - IPC using Message Passing (Producer Consumer) Code Download
08 - Banker's Algorithm Code Download
09 - Memory Allocation for Fixed Partition Check Subsection Download
10 - Page Replacement Algorithms Check Subsection Download
11 - Disk Scheduling Algorithms Check Subsection Download

Getting Error While Clicking Download?

When clicking on "Download", GitHub may lead to a page saying "Error rendering embedded code, Invalid PDF", even though all files are within this repository.

Solution

The solution to this problem is common to all OS, that is, to download the file from the hamburger menu as in the following screenshot.

Windows No error Windows solution
Windows (displaying properly) Solution in Windows (improper display)

Shell Programs

Programs Code
01 - Odd or Even Code
02 - Greatest of Three Numbers Code
03 - Factorial of Number Code
04 - Fibonacci Series Code
05 - Calculator Code
06 - Prime number upto a limit Code

Notes

You can run shell programs in any number of ways.

./file.sh
sh file.sh
bash files.sh
source ./file.sh
. ./file.sh

If you are getting errors while running shell scripts, the reasons may be:

  • the file includes syntaxes used in C language.
  • No proper file privileges for executing, upon which you may have to run the following command assuming the terminal is opened where the file.sh exists:
    chmod +x ./file.sh
    
Download Top

System Calls

Program Code
01 - Exec() Code
02 - Fork() Code
03 - getPID() Code
04 - Stat() Code
05 - Opendir() Readdir() Code
06 (a) - Wait() Code
06 (b) - Waits Code

Notes before running some programs

Note 1

Keep hello.c in the same folder as exec system call file exists.
Then run the following command in the terminal:

gcc ./hello.c -o hello

followed by compiling your exec system call file as follows:

gcc ./exec.c

Note 2

Keep hello.c in the same folder prior to running stat system call. This is required to display the properties of the file hello.c in terminal.

Download Top

Scheduling Algorithms

Program Code
01 - FCFS Code
02 - SJF Code
03 - Round Robin Code
04 - SRTF Code
05 - Preemptive Priority Code
06 - Non Preemptive Priority Code
Alternative Code Download Top

IPC Using Shared Memory

Program Code
01 - Shared Memory Code 1, Code 2
02 - Pipe Code

Note

Both the files (Code 1 and Code 2) must be downloaded into the same folder.
Then Code 1 should be compiled and ./a.out must be executed. (Nothing will happen at that moment).
Then Code 2 should be compiled and ./a.out must be executed which will display the output.
You can view the output in the following pdf file.

Download Top

Memory Allocation Using the Fixed Partition

Program Code
01 - First Fit Code
02 - Best Fit Code
03 - Worst Fit Code
Alternative Code Download Top

Page Replacement Algorithms

Program Code
01 - FIFO Code
02 - LRU Code
03 - LFU Code
Alternative Code Download Top

Disk Scheduling

Program Code
01 - FCFS Code
02 - SCAN Code
03 - C-SCAN Code
Alternative Code Download Top

About

Codes aggregated and corrected by S Sreeram. The repository belongs to him.

Resources

Stars

Watchers

Forks