0% found this document useful (0 votes)
5 views9 pages

CYcle 1 Answer Key

The document provides an answer key for a Cycle Test in the Department of Computer Science and Engineering for the Even Semester 2024-2025. It includes questions and answers on operating systems, covering topics such as system calls, scheduling criteria, multiprocessor and multicore organization, and various operating system structures. Additionally, it contains Gantt charts and calculations for different scheduling algorithms based on given processes.

Uploaded by

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

CYcle 1 Answer Key

The document provides an answer key for a Cycle Test in the Department of Computer Science and Engineering for the Even Semester 2024-2025. It includes questions and answers on operating systems, covering topics such as system calls, scheduling criteria, multiprocessor and multicore organization, and various operating system structures. Additionally, it contains Gantt charts and calculations for different scheduling algorithms based on given processes.

Uploaded by

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

Department of Computer Science and Engineering

Even Semester 2024 – 2025


CYCLE TEST – I ANSWER KEY
PART - A (10 x 2 = 20 MARKS)
ANSWER ALL THE QUESTIONS

1 What is an Operating system?


An operating system is a program that manages the computer hardware. It also
provides a basis for application programs and act as an intermediary between a user of a
computer and the computer hardware. It controls and coordinates the use of the hardware
among the various application programs for the various users.

2 How does an interrupt differ from a trap?


An interrupt is a hardware-generated signal that changes the flow within the
system. A trap is a software-generated interrupt. An interrupt can be used to signal the
completion of
I/O so that the CPU doesn't have to spend cycles polling the device.
A trap can be used to catch arithmetic errors or to call system routines

3 Compare and contrast DMA and cache memory.


DMA(Direct Memory Access): Direct memory access (DMA) is a feature of
computer systems that allows certain hardware subsystems to access main memory
(Random-access memory), independent of the central processing unit (CPU).
Cache Memory: A cache is a smaller, faster memory, closer to a processor core,
which stores copies of the data from frequently used main memory locations.
So, both DMA and cache are used for increasing the speed of memory access.

4 What do you mean by system calls?


System calls provide the interface between a process and the operating system.
When a system call is executed, it is treated as by the hardware as software interrupt.

5 Discuss the main advantages of layered approach to system design?


As in all cases of modular design, designing an operating system in a modular way has
several advantages. The system is easier to debug and modify because changes affect only
limited sections of the system rather than touching all sections of the operating system.
Information is kept only where it is needed and is accessible only within a defined
and restricted area, so any bugs affecting that data must be limited to a specific module or
layer.

6 What is bootstrap program?


A bootstrap program is the first code that is executed when the computer system is
started. The entire operating system depends on the bootstrap program to work correctly as
it loads the operating system.
7 Define: process
A process is a program in execution. It is an active entity and it includes the
process stack, containing temporary data and the data section contains global variables.

1
8 What are the use of job queues, ready queues and device queues?
As a process enters a system they are put in to a job queue. This queues consist of
all jobs in the system.
The processes that are residing in main memory and are ready and waiting to
execute are kept on a list called ready queue.
The list of processes waiting for particular I/O devices kept in the device queue.

9 Feature Preemptive Scheduling Nonpreemptive Scheduling


CPU can be taken from a
A process runs until completion or
Definition running process and assigned
voluntarily releases the CPU.
to another.
Interruptio Allowed; processes can be Not allowed; once a process starts, it runs
ns interrupted. till it finishes or blocks.
Response Faster; good for real-time
Slower; may cause long wait times.
Time systems.

Round Robin, Shortest First Come First Serve (FCFS), Shortest Job
Example
Remaining Time First (SRTF). First (SJF) (nonpreemptive).
10 What are the various scheduling criteria for CPU scheduling?
The various scheduling criteria are,
• CPU utilization
• Throughput
• Turnaround time
• Waiting time
• Response time

PART - B (3 x 10 = 30 MARKS)
ANSWER ANY THREE QUESTIONS
1 Explain different operating system structures with neat sketch.
1 OPERATING SYSTEM STRUCTURE:
The operating systems are large and complex. A common approach is to partition the task
into small components, or modules, rather than have one monolithic system.
The structure of an operating system can be defined the following structures.
Simple structure
Layered approach
Microkernels
Modules
Hybrid systems
1.Simple structure:
The Simple structured operating systems do not have a well-defined structure. These systems will
be simple, small and limited systems.
Example: MS-DOS.
In MS-DOS, the interfaces and levels of functionality are not well separated.
In MS-DOS application programs are able to access the basic I/O routines. This causes the
entire systems to be crashed when user programs fail.

2
2.Layered approach:
A system can be made modular in many ways. One method is the layered approach, in which the
operating system is broken into a number of layers (levels). The bottom layer (layer 0) is the
hardware; the highest (layer
is the user interface. An operating-system layer is an implementation of an abstract object made up
of data and the operations that can manipulate those data. The main advantage of the layered
approach is simplicity of construction and debugging. The layers are selected so that each uses
functions (operations) and services of only lower-level layers. Each layer is implemented only with
operations provided by lower-level layers. A layer does not need to know how these operations are
implemented; it needs to know only what these operations do.
The major difficulty with the layered approach involves appropriately defining the various
layers because a layer can use only lower-level layers.

3.Microkernels:
In the mid-1980s, researchers at Carnegie Mellon University developed an operating system
called Mach that modularized the kernel using the microkernel approach.
This method structures the operating system by removing all nonessential components from
the kernel and implementing them as system and user-level programs.
Microkernel provide minimal process and memory management, in addition to a
communication facility. The main function of the microkernel is to provide communication between
the client program and the various services that are also running in user space.
The client program and service never interact directly. Rather, they communicate indirectly
by exchanging messages with the microkernel.
One benefit of the microkernel approach is that it makes extending the operating system easier. All
new services are added to user space and consequently do not require modification of the kernel.
The performance of microkernel can suffer due to increased system-function overhead.
4.Modules:
The best current methodology for operating-system design involves using loadable kernel
modules
The kernel has a set of core components and links in additional services via modules, either

3
at boot time or during run time.
The kernel provides core services while other services are implemented dynamically, as the
kernel is running.
Linking services dynamically is more comfortable than adding new features directly to the kernel,
which would require recompiling the kernel every time a change was made.

5.Hybrid Systems:
The Operating System combines different structures, resulting in hybrid systems that address
performance, security, and usability issues.
They are monolithic, because having the operating system in a single address space provides very
efficient performance. However, they are also modular, so that new functionality can be
dynamically added to the kernel.

12 Explain the various types of system calls with examples.

System calls provide an interface between a program and the operating system, enabling
programs to request services from the OS kernel. System calls allow user-level applications to
perform tasks such as file operations, process management, memory management, and device I/O.
There are several types of system calls, each serving a specific purpose. Here's an overview of the
various types of system calls with examples:

1. Process Control System Calls

These system calls manage processes, including process creation, termination, and scheduling.

Example System Calls:

o fork(): Creates a new process by duplicating the calling process. The new process is
called the child process.
o exec(): Replaces the current process with a new program.
o exit(): Terminates the calling process and returns an exit status to the parent
process.
o wait(): Makes the parent process wait for the child process to terminate before
proceeding.
o getpid(): Returns the process ID of the calling process.
o kill(): Sends a signal to a process, often used to terminate or pause it.

2. File Management System Calls

These system calls provide services related to file manipulation, such as opening, reading, writing,
and closing files.

Example System Calls

o open(): Opens a file and returns a file descriptor.

4
o read(): Reads data from a file.
o write(): Writes data to a file.
o close(): Closes an open file.
o lseek(): Moves the file pointer to a specific position in the file.
o unlink(): Deletes a file from the filesystem.
o stat(): Retrieves information about a file (e.g., size, permissions, timestamps).

3. Device Management System Calls

These system calls are responsible for managing devices like printers, hard drives, and network
interfaces.

Example System Calls:

o ioctl(): Used to control device-specific operations (like adjusting printer settings).


o read()/write(): Used for reading and writing data to devices (e.g., disk or network
interfaces).
o mmap(): Maps files or devices into memory.

4. Memory Management System Calls

These system calls are used to manage memory allocation, deallocation, and other memory-related
operations.

Example System Calls:

o mmap(): Maps files or devices into memory, allowing processes to access the
content directly in memory.
o brk(): Adjusts the program's data space (used for memory allocation).
o sbrk(): Increases or decreases the program's data space by a specified amount.
o munmap(): Unmaps a region of memory previously mapped by mmap().

5. Communication System Calls

These system calls provide mechanisms for communication between processes, including inter-
process communication (IPC).

Example System Calls:

o pipe(): Creates a unidirectional communication channel (pipe) for communication


between processes.
o shmget(): Creates a shared memory segment that can be accessed by multiple
processes.
o semget(): Creates or accesses a semaphore set, used for process synchronization.
o msgget(): Creates or accesses a message queue for sending and receiving messages
between processes.
o mprotect(): Changes the protection of a region of memory.

6. Information Maintenance System Calls

5
These system calls are responsible for providing information about the system, process status, and
the environment.

Example System Calls:

o gettimeofday(): Retrieves the current system time.


o uname(): Retrieves system information (e.g., OS name, version).
o getpid(): Gets the process ID of the calling process.
o getuid(): Gets the user ID of the calling process.
o setuid(): Sets the user ID for the calling process.

7. Networking System Calls

These system calls allow processes to communicate over a network (for instance, through TCP/IP
sockets).

Example System Calls:

o socket(): Creates a network socket.


o bind(): Binds a socket to a specific address and port.
o listen(): Prepares a socket to listen for incoming connections.
o accept(): Accepts an incoming connection on a socket.
o send()/recv(): Sends and receives data over a socket

13 Explain the concept of multiprocessor and Multicore organization.

Multiprocessor and Multicore Organization:

In modern computing systems, multiprocessor and multicore organizations are crucial to


enhancing performance, efficiency, and parallelism. These architectures are designed to improve
computational power by utilizing multiple processing units, but they do so in different ways. Let’s
break down each concept:

1. Multiprocessor Organization

Definition: A multiprocessor system is a computer architecture that uses multiple processors


(CPUs) to execute multiple tasks simultaneously. These processors work together to execute a
single task or handle different tasks, increasing the system's processing capability.

Types of Multiprocessor Systems

Symmetric Multiprocessing (SMP): In this system, all processors share a common memory space
and are treated equally. Each processor has access to the same main memory, and all processors can
execute tasks independently or cooperatively.

Advantages:

 Simple design.

6
 Processors can work on different tasks, improving system throughput.

Disadvantages:

 Contention for shared memory may become a bottleneck.


 Complex synchronization is needed for accessing memory.

Asymmetric Multiprocessing (AMP): In this system, one processor (the master processor)
controls the system, while the other processors (slave processors) execute specific tasks assigned by
the master.

Advantages:

 Simple design and control.


 The master processor has full control over the system.

Disadvantages:

 The master processor can become a bottleneck.


 Limited scalability since slave processors are controlled by the master.

Example:

A typical example of a multiprocessor system is a server farm with multiple processors handling
different parts of the workload. These servers may work together to serve a web page, handle
database queries, and perform calculations

2. Multicore Organization

Definition: A multicore system refers to a single processor (CPU) that contains multiple cores on a
single chip. Each core is essentially a smaller, independent processor that can handle its own task or
thread. Multicore processors enable parallelism by allowing multiple instructions to be executed
simultaneously, improving overall performance.

 Multiple Processing Units on a Single Chip: A multicore CPU contains multiple cores
that share the same physical chip. Each core has its own execution unit, cache, and registers
but shares resources like the system bus.
 Parallelism: Each core can execute different instructions simultaneously, allowing
programs to run multiple threads or tasks in parallel. This is particularly beneficial for
applications that can be divided into smaller tasks, such as video editing, rendering, and
scientific computations.
 Improved Energy Efficiency: Unlike adding multiple processors, multicore systems are
more power-efficient because they reduce the need for multiple separate chips.

Advantages:

 Improved Performance: By executing multiple threads concurrently, multicore systems


offer a significant performance boost for parallelizable tasks.
 Energy Efficiency: A multicore system typically consumes less power than an equivalent
multiprocessor system because multiple cores share resources within the same chip.
 Cost Efficiency: Manufacturing multiple cores on a single chip can be more cost-effective
than having multiple separate processors.

7
14 Consider the following set of processes with the length of the CPU – burst time in given ms :
Process Arrival Time BurstTime Priority
P1 0 8 3
P2 1 4 2
P3 2 9 1

Draw four Gantt charts illustrating the execution of these processes using FCFS, SJF, priority
and RR (quantum = 2) scheduling. Also calculate waiting time and turnaround time for each
scheduling algorithms.

1. First-Come, First-Served (FCFS) Scheduling

FCFS scheduling algorithm executes processes in the order they arrive, without preemption.

Arrival Time Burst Time Completion TAT WT


Process Time
P1 0 8 8 8 0
P2 1 4 12 11 7
P3 2 9 21 19 10

GANTT CHART
| P1 | P2 | P3 |
0 8 12 21
AVG TAT=12.6MS
AVG WT=5.6
2.SJF
Process Arrival Time Burst time CT TAT WT
P1 0 8 8 8 0
P2 1 4 12 11 7
P3 2 9 21 9 10

GANTT CHART
| P1 | P2 | P3 |
0 8 12 21
AVG TAT=12.6MS
AVG WT=5.6

3.PRIORITY

Arrival BT CT TAT WT PRIORITY


PROCESS time
P1 0 8 8 8 0 3
P2 1 4 21 20 16 2
P3 2 9 17 15 6 1
GANTT CHART
| P1 | P3 | P2 |
0 8 17 21
AVG TAT=14.3MS
AVG WT=7.3
4.ROUND ROBIN

PROCESS AT BT CT TAT WT

8
P1 0 8 18 18 10
P2 1 4 10 9 5
P3 2 9 21 19 10

GANTT CHART
| P1 | P2 | P3| P1| P2 | P3 | P1 | P3 | P1 | P3 |
0 2 4 6 8 10 12 14 16 18 21
AVG TAT=15.3MS
AVG WT=8.3

FACULTY IN CHARGE HOD

You might also like