objective: to learn about the various system calls. to perform the various cpu scheduling...
TRANSCRIPT
![Page 1: OBJECTIVE: To learn about the various system calls. To perform the various CPU scheduling algorithms. To understand the concept of memory management schemes](https://reader030.vdocuments.site/reader030/viewer/2022033104/5697bfbc1a28abf838ca1a87/html5/thumbnails/1.jpg)
CS1255 – OPERATING
SYSTEMS LABORATORY
![Page 2: OBJECTIVE: To learn about the various system calls. To perform the various CPU scheduling algorithms. To understand the concept of memory management schemes](https://reader030.vdocuments.site/reader030/viewer/2022033104/5697bfbc1a28abf838ca1a87/html5/thumbnails/2.jpg)
OBJECTIVE:• To learn about the various system calls.• To perform the various CPU scheduling
algorithms.• To understand the concept of memory
management schemes.• To know more about the semaphores and
Inter process communication.
AIM:
To understand the basic concepts of operating system.
![Page 3: OBJECTIVE: To learn about the various system calls. To perform the various CPU scheduling algorithms. To understand the concept of memory management schemes](https://reader030.vdocuments.site/reader030/viewer/2022033104/5697bfbc1a28abf838ca1a87/html5/thumbnails/3.jpg)
LIST OF EXERCISES
S.NO TITLE OF THE PROGRAMS
1.a. Program using exec & wait system calls
1.b. Program using fork & exit system calls
1.c. Program using opendir & readdir system calls
1.d. Program using stat system calls
2. Program to implement I/O system call of unix operating system
3.a. Simulation of ls command
3.b. Simulation of grep command
4.a. Implementation of First Come First Serve Scheduling algorithm
4.b. Implementation of Shortest Job First Scheduling algorithm
![Page 4: OBJECTIVE: To learn about the various system calls. To perform the various CPU scheduling algorithms. To understand the concept of memory management schemes](https://reader030.vdocuments.site/reader030/viewer/2022033104/5697bfbc1a28abf838ca1a87/html5/thumbnails/4.jpg)
S.NO TITLE OF THE PROGRAMS
5. Implementation of Priority & Round Robin Scheduling algorithm
6. Application using Inter Process Communication
7.Implementation of Producer – Consumer Problem using Semaphores
8.Implementation of Memory Management Scheme -I
9.Implementation of Memory Management Scheme -II
10.a.Implementation of First In First Out Page Replacement algorithm
10.b.Implementation of Best Fit algorithm
10.c.Implementation of First Fit algorithm
![Page 5: OBJECTIVE: To learn about the various system calls. To perform the various CPU scheduling algorithms. To understand the concept of memory management schemes](https://reader030.vdocuments.site/reader030/viewer/2022033104/5697bfbc1a28abf838ca1a87/html5/thumbnails/5.jpg)
Hardware and Software required
• HARDWARE: Personal Computers
• SOFTWARE: Linux
![Page 6: OBJECTIVE: To learn about the various system calls. To perform the various CPU scheduling algorithms. To understand the concept of memory management schemes](https://reader030.vdocuments.site/reader030/viewer/2022033104/5697bfbc1a28abf838ca1a87/html5/thumbnails/6.jpg)
SYSTEM CALLSA request to the operating system to perform some
activitySystem call is how a program requests a service
from an operating system 's kernelSystem calls provide the interface between a
process and the operating system.
![Page 7: OBJECTIVE: To learn about the various system calls. To perform the various CPU scheduling algorithms. To understand the concept of memory management schemes](https://reader030.vdocuments.site/reader030/viewer/2022033104/5697bfbc1a28abf838ca1a87/html5/thumbnails/7.jpg)
![Page 8: OBJECTIVE: To learn about the various system calls. To perform the various CPU scheduling algorithms. To understand the concept of memory management schemes](https://reader030.vdocuments.site/reader030/viewer/2022033104/5697bfbc1a28abf838ca1a87/html5/thumbnails/8.jpg)
EXAMPLE OF SYSTEM CALLS
getuid() //get the user IDfork() //create a child processexec() //executing a program
![Page 9: OBJECTIVE: To learn about the various system calls. To perform the various CPU scheduling algorithms. To understand the concept of memory management schemes](https://reader030.vdocuments.site/reader030/viewer/2022033104/5697bfbc1a28abf838ca1a87/html5/thumbnails/9.jpg)
SCHEDULING ALGORITHMS A scheduling algorithm is the method by which
threads, processes or data flows are given access to system resources (e.g. processor time, communications bandwidth).
This is usually done to load balance a system effectively or achieve a target quality of service.
![Page 10: OBJECTIVE: To learn about the various system calls. To perform the various CPU scheduling algorithms. To understand the concept of memory management schemes](https://reader030.vdocuments.site/reader030/viewer/2022033104/5697bfbc1a28abf838ca1a87/html5/thumbnails/10.jpg)
SCHEDULING ALGORITHMS
First-come, first-served scheduling (FCFS) algorithm
Shortest Job First Scheduling (SJF) algorithm Non-preemptive priority Scheduling algorithm Preemptive priority Scheduling algorithm Round-Robin Scheduling algorithm Multilevel Feedback Queue Scheduling algorithm Multilevel Queue Scheduling algorithm
![Page 11: OBJECTIVE: To learn about the various system calls. To perform the various CPU scheduling algorithms. To understand the concept of memory management schemes](https://reader030.vdocuments.site/reader030/viewer/2022033104/5697bfbc1a28abf838ca1a87/html5/thumbnails/11.jpg)
FCFS
Process Burst TimeP1 24 P2 3 P3 3
Suppose that the processes arrive in the order: P1 , P2 , P3
The Gantt Chart for the schedule is:
Waiting time for P1 = 0; P2 = 24; P3 = 27Average waiting time: (0 + 24 + 27)/3 = 17
P1 P2 P3
24 27 300
![Page 12: OBJECTIVE: To learn about the various system calls. To perform the various CPU scheduling algorithms. To understand the concept of memory management schemes](https://reader030.vdocuments.site/reader030/viewer/2022033104/5697bfbc1a28abf838ca1a87/html5/thumbnails/12.jpg)
SJFProcess Arrival Time Burst TimeP1 0.0 7
P2 2.0 4
P3 4.0 1
P4 5.0 4
SJF (non-preemptive)
Average waiting time = (0 + 6 + 3 + 7)/4 = 4
P1 P3 P2
73 160
P4
8 12
![Page 13: OBJECTIVE: To learn about the various system calls. To perform the various CPU scheduling algorithms. To understand the concept of memory management schemes](https://reader030.vdocuments.site/reader030/viewer/2022033104/5697bfbc1a28abf838ca1a87/html5/thumbnails/13.jpg)
Process Arrival Time Burst TimeP1 0.0 7
P2 2.0 4
P3 4.0 1
P4 5.0 4
SJF (preemptive)
Average waiting time = (9 + 1 + 0 +2)/4 = 3
P1 P3P2
42 110
P4
5 7
P2 P1
16
![Page 14: OBJECTIVE: To learn about the various system calls. To perform the various CPU scheduling algorithms. To understand the concept of memory management schemes](https://reader030.vdocuments.site/reader030/viewer/2022033104/5697bfbc1a28abf838ca1a87/html5/thumbnails/14.jpg)
Priority Scheduling
A priority number (integer) is associated with each process
The CPU is allocated to the process with the highest priority (smallest integer ≡ highest priority).
1. Preemptive 2. non-preemptiveSJF is a priority scheduling where priority is the
predicted next CPU burst time.Problem ≡ Starvation – low priority processes
may never execute.Solution ≡ Aging – as time progresses increase
the priority of the process.
![Page 15: OBJECTIVE: To learn about the various system calls. To perform the various CPU scheduling algorithms. To understand the concept of memory management schemes](https://reader030.vdocuments.site/reader030/viewer/2022033104/5697bfbc1a28abf838ca1a87/html5/thumbnails/15.jpg)
RR
(Quantum=20) Process Burst TimeP1 53 P2 17 P3 68 P4 24
The Gantt chart is:
Typically, higher average turnaround than SJF, but better response
P1 P2 P3 P4 P1 P3 P4 P1 P3 P3
0 20 37 57 77 97 117 121 134 154 162
![Page 16: OBJECTIVE: To learn about the various system calls. To perform the various CPU scheduling algorithms. To understand the concept of memory management schemes](https://reader030.vdocuments.site/reader030/viewer/2022033104/5697bfbc1a28abf838ca1a87/html5/thumbnails/16.jpg)
INTER PROCESS COMMUNICATION
Inter-process communication (IPC) is a set of techniques for the exchange of data among multiple threads in one or more processes .
Processes may be running on one or more computers connected by a network.
![Page 17: OBJECTIVE: To learn about the various system calls. To perform the various CPU scheduling algorithms. To understand the concept of memory management schemes](https://reader030.vdocuments.site/reader030/viewer/2022033104/5697bfbc1a28abf838ca1a87/html5/thumbnails/17.jpg)
SEMAPHORES
Semaphores provide mutual exclusion.
They are used for process sync and are used to resolve deadlock conditions.
They are used in pairs basically wait() and signal().
Commonly used semaphore is mutex()
![Page 18: OBJECTIVE: To learn about the various system calls. To perform the various CPU scheduling algorithms. To understand the concept of memory management schemes](https://reader030.vdocuments.site/reader030/viewer/2022033104/5697bfbc1a28abf838ca1a87/html5/thumbnails/18.jpg)
PAGE REPLACEMENT ALGORITHMS page replacement algorithms decide which
memory pages to page out (swap out, write to disk) when a page of memory needs to be allocated.
Paging happens when a page fault occurs and a free page cannot be used to satisfy the allocation
![Page 19: OBJECTIVE: To learn about the various system calls. To perform the various CPU scheduling algorithms. To understand the concept of memory management schemes](https://reader030.vdocuments.site/reader030/viewer/2022033104/5697bfbc1a28abf838ca1a87/html5/thumbnails/19.jpg)
Memory ManagementMemory-Management Unit (MMU)
![Page 20: OBJECTIVE: To learn about the various system calls. To perform the various CPU scheduling algorithms. To understand the concept of memory management schemes](https://reader030.vdocuments.site/reader030/viewer/2022033104/5697bfbc1a28abf838ca1a87/html5/thumbnails/20.jpg)
SWAPPING
![Page 21: OBJECTIVE: To learn about the various system calls. To perform the various CPU scheduling algorithms. To understand the concept of memory management schemes](https://reader030.vdocuments.site/reader030/viewer/2022033104/5697bfbc1a28abf838ca1a87/html5/thumbnails/21.jpg)
PAGING
![Page 22: OBJECTIVE: To learn about the various system calls. To perform the various CPU scheduling algorithms. To understand the concept of memory management schemes](https://reader030.vdocuments.site/reader030/viewer/2022033104/5697bfbc1a28abf838ca1a87/html5/thumbnails/22.jpg)
Page Replacement Algorithms(FIFO)
![Page 23: OBJECTIVE: To learn about the various system calls. To perform the various CPU scheduling algorithms. To understand the concept of memory management schemes](https://reader030.vdocuments.site/reader030/viewer/2022033104/5697bfbc1a28abf838ca1a87/html5/thumbnails/23.jpg)