0% found this document useful (0 votes)
144 views18 pages

Advance Java Project

This is micro project on cpu scheduling and process synchronisation using advanced Java language along with source code

Uploaded by

desar69234
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
144 views18 pages

Advance Java Project

This is micro project on cpu scheduling and process synchronisation using advanced Java language along with source code

Uploaded by

desar69234
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

A PROJECT REPORT

ON
CPU SCHEDULING AND PROCESS
SYNCHRONIZATION

SUBMITTED
BY
VINIT KALE

Under The guidance of


MR. D.D SHELKE

In partial fulfillment for the award of the diploma


IN
Computer engineering

1
CERTIFICATE

This Is To Certify That Vinit Kale (1537) Of Fifth Semester Of


Diploma In Computer Engineering Of Institute S.H.Jondhale
Polytechnic (Code :- 0044) Completed The Micro Project Has
Satisfactorily In Subject Name:- Operating System
Prescribed In The Curriculum.

PLACE: - DOMBIVLI DATE:-

SUBJECT TEACHER HEAD OF PRINCIPAL

DEPARTMENT

2
Acknowledgement
I would like to express my special thanks to my sir
MR.D.D.SHELKE

For his able guidance and support in completing this project. I would also like to
extend my gratitude to our principal and HOD providing us With all the faculty
that was required for this project. It also helped me doing lot of research & came
to know many new things I’m really thanking full to them….

3
Abstract
This microproject focuses on the essential topics of
"CPU scheduling and process synchronization"
within operating systems. It provides a concise
exploration of scheduling algorithms and process
synchronization mechanisms. The project aims to
equip students and enthusiasts with practical
knowledge and skills for optimizing system resource
utilization and managing concurrent processes in a
multitasking environment.

4
WEEKLY DIARY

Week Starting date Finish date Details of the activity carried out
No.
Week 01 24/07/2023 30/07/2023 Decided the topic to be chosen

Week 02 31/07/2023 06/08/2023 Understood the topic chosen

Week 03 07/08/2023 13/08/2023 Gathered the information for the topic


chosen

Week 04 14/08/2023 20/08/2023 Sorted the gathered information according


to the respective needs

Week 05 21/08/2023 27/08/2023 Started the preparation of the


Microproject for the topic chosen

Week 06 28/08/2023 03/09/2023 Implemented the gathered information


according to the requirement in the
microproject

Week 07 04/09/2023 10/09/2023 Gathered the respective required images


according to the topic chosen

5
Week 08 11/09/2023 17/09/2023 Arranged everything implemented by
imposing proper alignment etc in the
created microproject

Week 09 18/09/2023 24/09/2023 Tested and debugged the entire


information added in the microproject

Week 10 25/09/2023 01/10/2023 Corrected the errors found during testing


and debugging and made changes
accordingly Some main errors found were
-- spell errors, improper imposed
alignment, incorrect font for some texts,
etc
Week 11 02/10/2023 08/10/2023 Converted the microproject word
document created to respective pdf
document for ease of printing

Week 12 09/10/2023 15/10/2023 Verified the created microproject from the


respective subject staff for the
confirmation of taking printouts of the
microproject
Week 13 16/10/2023 22/10/2023 Imposed the corrections and changes
suggested by the subject staff and created
the final copy of the microproject which
can be further processed for taking final
printouts
Week 14 23/10/2023 29/10/2023 Took printouts of the respective
microproject created
Week 15 30/10/2023 05/10/2023 Did spiral binding of the printouts and
arranged them according to the Sequence

Week 16 06/10/2023 12/10/2023 Submitted the microproject

6
Index

Sr.no Page
content no
1. INTRODUCTION

2. CPU SCHEDUlING & ITS TYPES

3. CPU TERMINOlOGIES

4. CPU SCHEDUlING AlGORITHMS

5. PROCESS SYNCHRONIZATION

6. CONCLUSION

7. REFRENCES

7
Process Scheduling and Process Synchronization

Introduction
1.Rationale: -
An operating system performs all the basic tasks like managing files, processes,
and memory. Thus operating system acts as manager of the all resources, i.e.,
resource manager. Thus the operating system becomes an interface between user
and machine. An operating system is defined as a system of software without
which a machine cannot boot. In other words, the operating system is defined as
one of the most important software that drives the hardware as well as software
present on the machine or computer.

2.Course outcomes integrated: -


A. Install operating system and configure it.
B. Use operating system tools to perform various function.

3.Literature review: -
The operating system is now being widely used in many of the various modern
applications in recent years, ranging from diabetic monitoring to other strategic
planning. The main function of any OS is to control and coordinate all hardware
resources among the commands of the same/different user which increases the
efficiency of advanced comprehensive applications. In an autonomous computer
system CPU is one of the important resources to manage and process all
activities which require scheduling techniques on a processor. Since the early
day of computing and other multiprogramming OS, various studies have been
assigned to CPU scheduling techniques based on processes management and
performance evaluation.
Process synchronization is a way to coordinate processes that use shared data. It
occurs in an operating system among cooperating processes. Cooperating
processes are processes that share resources. While executing many concurrent
processes, process synchronization helps to maintain shared data consistency
and cooperating process execution.
1. CPU Scheduling:
CPU Scheduling is a process of determining which process will own CPU for
execution while another process is on hold. The main task of CPU scheduling is
to make sure that whenever the CPU remains idle, the OS at least selects one of

8
the processes available in the ready queue for execution. The selection process
will be carried out by the CPU scheduler. It selects one of the processes in
memory that are ready for execution.
There are 2 types of CPU Scheduling: -
i. Pre-emptive Scheduling ii. Non-
Pre-emptive Scheduling

i. Pre-emptive Scheduling:
In Pre-emptive Scheduling, the tasks are mostly assigned with their
priorities. Sometimes it is important to run a task with a higher
priority before another lower priority task, even if the lower priority
task is still running. The lower priority task holds for some time and
resumes when the higher priority task finishes its execution.

ii. Non-Pre-emptive Scheduling:


In this type of scheduling method, the CPU has been allocated to a
specific process. The process that keeps the CPU busy will release
the CPU either by switching context or terminating. It is the only
method that can be used for various hardware platforms. That’s
because it doesn’t need special hardware (for example, a timer)
like pre-emptive scheduling.
2. Important CPU Scheduling Terminologies:
i. Burst Time/Execution Time: It is the time required by the process to
complete execution. It is also called running time.
ii. Arrival Time: when a process enters in a ready state

9
iii. Finish Time: when the process is complete and exits from a system iv.
Multiprogramming: A number of programs that can be present in
memory at the same time.
v. Jobs: It is a type of program without any kind of user interaction.
vi. User: It is a kind of program having user interaction. vii.
Process: It is the reference that is used for both job and user.
viii. CPU/IO burst cycle: Characterizes process execution, which alternates
between CPU and I/O activity. CPU times are usually shorter than the
time of I/O.

3. Types of CPU scheduling Algorithm:


There are mainly six types of process scheduling algorithms

1. First Come First Serve (FCFS)


2. Shortest-Job-First (SJF) Scheduling
3. Shortest Remaining Time
4. Priority Scheduling
5. Round Robin Scheduling
6. Multilevel Queue Scheduling

I. First Come First Serve:


i. First Come First Serve is the full form of FCFS. It is the easiest and
most simple CPU scheduling algorithm. In this type of algorithm, the
process which requests the CPU gets the CPU allocation first. This
scheduling method can be managed with a FIFO queue.
ii. As the process enters the ready queue, its PCB (Process Control
Block) is linked with the tail of the queue. So, when the CPU becomes
free, it should be assigned to the process at the beginning of the queue.
iii. Characteristics:

a. It offers a non-preemptive and pre-emptive scheduling


algorithm.
b. Jobs are always executed on a first-come, first-serve basis
c. It is easy to implement and use.
II. Shortest Job First (SJF):
i. SJF is a full form of (Shortest job first) is a scheduling algorithm in
which the process with the shortest execution time should be selected
for execution next. This scheduling method can be pre-emptive or non-
pre-emptive. It significantly reduces the average waiting time for other
processes awaiting execution.
ii. Characteristics of SJF Scheduling

10
a. It is associated with each job as a unit of time to complete.
b. In this method, when the CPU is available, the next process or job
with the shortest completion time will be executed first.
c. It is Implemented with a non-pre-emptive policy.
d. This algorithm method is useful for batch-type processing, were
waiting for jobs to complete is not critical. It improves job output
by offering shorter jobs, which should be executed first, which
mostly have a shorter turnaround time.

III. Shortest Remaining Time:


i. The full form of SRT is Shortest remaining time. It is also known as
SJF pre-emptive scheduling. In this method, the process will be
allocated to the task, which is closest to its completion. This method
prevents a newer ready state process from holding the completion of
an older process.
ii. Characteristics of SRT scheduling method:

a. This method is mostly applied in batch environments where short


jobs are required to be given preference.
b. This is not an ideal method to implement it in a shared system
where the required CPU time is unknown.
c. Associate with each process as the length of its next CPU burst. So
that operating system uses these lengths, which helps to schedule
the process with the shortest possible time.
IV. Priority Scheduling:
i. Priority scheduling is a method of scheduling processes based on
priority. In this method, the scheduler selects the tasks to work as per
the priority.
ii. Priority scheduling also helps OS to involve priority assignments. The
processes with higher priority should be carried out first, whereas jobs
with equal priorities are carried out on a round-robin or FCFS basis.
Priority can be decided based on memory requirements, time
requirements, etc.

V. Round Robin Scheduling:

11
i. Round robin is the oldest, simplest scheduling algorithm. The name of
this algorithm comes from the round-robin principle, where each
person gets an equal share of something in turn.
ii. It is mostly used for scheduling algorithms in multitasking. This
algorithm method helps for starvation-free execution of processes.
iii. Characteristics of Round-Robin Scheduling

a. Round robin is a hybrid model which is clock-driven


b. Time slice should be minimum, which is assigned for a specific
task to be processed. However, it may vary for different processes.
c. It is a real-time system which responds to the event within a
specific time limit.

VI. Multiple Queue Scheduling:


i. This algorithm separates the ready queue into various separate queues.
In this method, processes are assigned to a queue based on a specific
property of the process, like the process priority, size of the memory,
etc.
ii. However, this is not an independent scheduling OS algorithm as it
needs to use other types of algorithms in order to schedule the jobs.
iii. Characteristic of Multiple-Level Queues Scheduling:

a. Multiple queues should be maintained for processes with some


characteristics.
b. Every queue may have its separate scheduling algorithms.
c. Priorities are given for each queue.
4. Process Synchronization:
Process Synchronization is a way to coordinate processes that use shared
data. It occurs in an operating system among cooperating processes. While
executing many concurrent processes, process synchronization helps to maintain
shared data consistency and cooperating process execution.

i. Critical Section Problem:


Critical section is a code segment that can be accessed by only one
process at a time. Critical section contains shared variables that need to be
synchronized to maintain consistency of data variables. Any solution to the
critical section problem must satisfy three requirements:
a. Mutual Exclusion: If a process is executing in its critical section, then no
other process is allowed to execute in the critical section.

12
b. Progress: If no process is executing in the critical section and other
processes are waiting outside the critical section, then only those
processes that are not executing in their remainder section can participate
in deciding which will enter in the critical section next, and the selection
cannot be postponed indefinitely.
c. Bounded Waiting: A bound must exist on the number of times that other
processes are allowed to enter their critical sections after a process has
made a request to enter its critical section and before that request is
granted.

ii. Inter Process Communication:


a. A process can be of two types:
1. Independent process.
2. Co-operating process.
b. An independent process is not affected by the execution of other
processes while a co-operating process can be affected by other executing
processes.
c. Though one can think that those processes, which are running
independently, will execute very efficiently, in reality, there are many
situations when co-operative nature can be utilized for increasing
computational speed, convenience, and modularity.
d. Inter-process communication (IPC) is a mechanism that allows processes
to communicate with each other and synchronize their actions.
e. The communication between these processes can be seen as a method of
co-operation between them
iii. Semaphores in Process Synchronization:
a. Semaphore was proposed by Dijkstra in 1965 which is a very significant
technique to manage concurrent processes by using a simple integer
value, which is known as a semaphore.
b. Semaphore is simply an integer variable that is shared between threads.
This variable is used to solve the critical section problem and to achieve
process synchronization in the multiprocessing environment.
c. Semaphores are of two types:
1. Binary Semaphore: This is also known as mutex lock. It can have
only two values – 0 and 1. Its value is initialized to 1. It is used to
implement the solution of critical section problems with multiple
processes.
2. Counting Semaphore: Its value can range over an unrestricted
domain. It is used to control access to a resource that has multiple
instances.

13
iv. Synchronization Hardware:
1. Many systems provide hardware support for critical section code. The
critical section problem could be solved easily in a single-processor
environment if we could disallow interrupts to occur while a shared
variable or resource is being modified.
2. In this manner, we could be sure that the current sequence of instructions
would be allowed to execute in order without pre-emption. Unfortunately,
this solution is not feasible in a multiprocessor environment.
3. Disabling interrupt on a multiprocessor environment can be time-
consuming as the message is passed to all the processors.
4. This message transmission lag delays the entry of threads into the critical
section, and the system efficiency decrease

v. Actual Procedure Followed: -


i. First, we decided the topic with all group members.
ii. So, we decided to do a project on CPU Scheduling and Process
Synchronization.
iii. For this first we work on gathering information about the given topic.
iv. According to our project requirement we tried to work on it with our
knowledge and under the guidance of our guide.
v. Them we doing implementation of our project.
vi. Then we write report on it.

14
6. Actual Resources Used:
Sr.No. Name of Resources Specifications Qty Remarks
1. Desktop/Laptop Intel i5 5th gen 8GB RAM 1 -

2. Operating System Windows 10 pro 1 -


3. Software Word 2019 1 -

7. Skill Developed/Learning out of this project:


It includes the report of this project. The project starts with discussing the
achievements of this project. In this project we learned that what is CPU Scheduling,
types of Scheduling algorithms, what is process synchronization, critical section
problems and their requirements, IPC, semaphores, and synchronization hardware etc.
8.Application of this project:
This project has some basic applications such as:
1. Understanding different category of Scheduling algorithm
2. Understands importance of CPU Scheduling.
3. Understands different types of Scheduling Algorithm.
4. Understands use and importance of Process Synchronization.

15
CONCLUSION

In conclusion, the microproject on CPU Scheduling and Process Synchronization has


been a valuable exploration of essential operating system concepts. It has allowed us
to grasp the significance of CPU scheduling algorithms in optimizing process
execution order and process synchronization mechanisms in maintaining data
consistency within a multi-process environment. We've gained practical experience by
implementing and evaluating various scheduling algorithms like FCFS,SJF, and
Round Robin, as well as employing synchronization tools such as semaphores and
mutexes to prevent data race conditions.

This project has provided us with practical skills and insights necessary to
address real-world operating system challenges. Mastery of CPU scheduling and
process synchronization principles is pivotal for developing efficient and robust
software systems, making a substantial contribution to our knowledge in
computer science and system engineering.

16
REFERENCE

https://www.geeksforgeeks.org/
https://www.tutorialspoint.com/

17
18

You might also like