0% found this document useful (0 votes)
14 views10 pages

Operating System and administration answer

The document provides an overview of operating systems, including their functions, types of installations, the Linux boot process, file attributes, process control blocks, pathnames, deadlocks, and scheduling algorithms. It explains dual-mode operation, the differences between CLI and GUI, and various methods for handling deadlocks. Additionally, it outlines the life cycle of processes and compares processes and threads in terms of memory space, overhead, and communication.

Uploaded by

amrutha
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)
14 views10 pages

Operating System and administration answer

The document provides an overview of operating systems, including their functions, types of installations, the Linux boot process, file attributes, process control blocks, pathnames, deadlocks, and scheduling algorithms. It explains dual-mode operation, the differences between CLI and GUI, and various methods for handling deadlocks. Additionally, it outlines the life cycle of processes and compares processes and threads in terms of memory space, overhead, and communication.

Uploaded by

amrutha
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/ 10

Operating System and administration

written test-1 Answers


SECTION -1
1.a) An operating system is a program that acts as an interface between the user and the
computer hardware and OS controls, co-ordinates and manages the hardware components
and all kinds of programs.

Dual-mode operation:

User process

User process Calls system Return from


executing call system call

Trap mode bit =0 Return mode bit=1


Kernel
Executes system
call

Diagram: Transition from user to kernel mode


 To ensure the proper execution of the operating system, it is necessary to be able to
distinguish between the execution of operating system code and user defined code.
 Most computer systems have taken the approach to provide hardware support that allows
to differentiate among various modes of execution.
 It is said that there are two modes of operation.
i)User mode ii)kernel mode
 A bit called the mode bit, is added to the hardware of the computer to indicate the current
mode- kernel(0) user(1). With this mode bit it is also possible to distinguish between a
task that is executed on behalf of the operating system or a task that is executed on behalf
of the user.
 At system boot time, the hardware starts in kernel mode. The operating system is then
loaded and starts user application in user mode.
 When a trap or interrupt occurs, the hardware switches to kernel mode from user mode,
that is, the state of the mode bit changes to 0.
 Thus, Whenever the operating system gains control of the computer, it is in kernel mode.
The system switches to user mode by setting the mode bit to 1.
 The dual mode of operation provides us with the means for protecting the operating
system from errant users.

b) CLI GUI
 A CLI is a Command Line Interface. A GUI is a Graphical user interface.
It is a visual interface that uses icons,
 It is a text based interface that uses keyboard buttons, windows and other graphical
Commands to interact with the OS. elements to interact with the OS.

 They are more efficient and faster than GUI’s They are less efficient than CLI’s and
because they direct all processing power to the task are not as powerful for complex tasks.
at hand.
 They are also better for complex tasks, like advance GUI’s are easier to use than CLI’s and
d system settings and administrative tasks. Are self-explanatory.
 CLI’s can be difficult to learn and prone to errors if
the user enters incorrect commands.

2.a) Types of OS installation


Attended installation:
 An installation process usually needs a user who attends it to make choices, such as
accepting or declining an end-user license agreement (EULA), specifying preferences such as the
installation location, supplying passwords or assisting in product activation.

 In graphical environments, installers that offer a wizard-based interface are common.

Silent installation:

 An installation that does not display messages or windows during its progress.

 "Silent installation" is NOT the same as "unattended installation". [All silent installations are
unattended but not all unattended installations are silent.]

Unattended installation:
 An installation that is performed without user interaction during its progress or with no user
present at all.

Headless installation:

 Installation performed without using a computer monitor connected.

 In attended forms of headless installation, another machine connects to the target machine (for
example, via a local area network) and takes over the display output.

Scheduled or Automated installation:

 An installation process that runs on a preset time or when a predefined condition meet the
requirements, as opposed to an installation process that starts explicitly on a user's command.

 An operating system may automatically install a device driver for a device that the user
connects.

Clean installation:

 A clean installation is one that is done in the absence of any interfering elements such as old
versions of the computer program being installed or leftovers from a previous installation.

 The clean installation of an operating system is an installation in which the target disk
partition is erased before installation.

Network installation:

Network installation (netinstall), is an installation of a program from a shared network resource


that may be done by installing a minimal system before proceeding to download further packages
over the network.

This may simply be a copy of the original media but software publishers which offer site licenses
for institutional customers may provide a version intended for installation over a network.

b) LINUX BOOT PROCESS


1. BIOS
 BIOS stands for Basic Input/Output System
 Performs some system integrity checks
 Searches, loads, and executes the boot loader program.
 So, in simple terms BIOS loads and executes the MBR boot loader.
2. MBR
 MBR stands for Master Boot Record.
 It contains information about GRUB (or LILO in old systems).
 So, in simple terms MBR loads and executes the GRUB boot loader.

3. GRUB
 GRUB stands for Grand Unified Bootloader.
 If you have multiple kernel images installed on your system, you can choose which one
to be executed.
 GRUB displays a splash screen, waits for few seconds, if you don’t enter anything, it
loads the default kernel image as specified in the grub configuration file.
 So, in simple terms GRUB just loads and executes Kernel and initrd images.

4. Kernel
 Mounts the root file system as specified in the “root=” in grub.conf
 Kernel executes the /sbin/init program
 Since init was the 1st program to be executed by Linux Kernel, it has the process id (PID)
of 1. Do a ‘ps -ef | grep init’ and check the pid.
 initrd stands for Initial RAM Disk.

5. Init
 Looks at the /etc/inittab file to decide the Linux run level.
 Following are the available run levels
 0 – halt
 1 – Single user mode
 2 – Multiuser, without NFS
 3 – Full multiuser mode
 4 – unused
 5 – X11
 6 – reboot

6. Runlevel programs
 When the Linux system is booting up, you might see various services getting started. For
example, it might say “starting sendmail …. OK”. Those are the runlevel programs,
executed from the run level directory as defined by your run level.
 Programs starts with S are used during startup. S for startup.
 Programs starts with K are used during shutdown. K for kill.

SECTION -2

3.a) File Attributes


Each file has characteristics like file name, file type, date (on which file was created), etc. These
characteristics are referred to as 'File Attributes'. The operating system associates these
attributes with files. In different operating systems files may have different attributes. Some
people call attributes metadata also.
Following are some common file attributes:

1. Name: File name is the name given to the file. A name is usually a string of characters.
2. Identifier: Identifier is a unique number for a file. It identifies files within the file system.
It is not readable to us, unlike file names.
3. Type: Type is another attribute of a file which specifies the type of file such as archive
file (.zip), source code file (.c, .java), .docx file, .txt file, etc.
4. Location: Specifies the location of the file on the device (The directory path). This
attribute is a pointer to a device.
5. Size: Specifies the current size of the file (in Kb, Mb, Gb, etc.) and possibly the maximum
allowed size of the file.
6. Protection: Specifies information about Access control (Permissions about Who can read,
edit, write, and execute the file.) It provides security to sensitive and private information.
7. Time, date, and user identification: This information tells us about the date and time
on which the file was created, last modified, created and modified by which user, etc.

b) Structure of the Process Control Block


A Process Control Block (PCB) is a data structure used by the operating system to manage
information about a process. The process control keeps track of many important pieces of
information needed to manage processes efficiently. The diagram helps explain some of these
key data items.

 Pointer: It is a stack pointer that is required to be saved when the process is switched
from one state to another to retain the current position of the process.
 Process state: It stores the respective state of the process.
 Process number: Every process is assigned a unique id known as process ID or PID
which stores the process identifier.
 Program counter: Program Counter stores the counter, which contains the address of
the next instruction that is to be executed for the process.
 Register: Registers in the PCB, it is a data structure. When a processes is running and
it’s time slice expires, the current value of process specific registers would be stored in
the PCB and the process would be swapped out. When the process is scheduled to be
run, the register values is read from the PCB and written to the CPU registers. This is
the main purpose of the registers in the PCB.
 Memory limits: This field contains the information about memory
management system used by the operating system. This may include page
tables, segment tables, etc.
 List of Open files: This information includes the list of files opened for a
process.

4.a) Pathname is a sequence of symbols and filenames which indicates the location of our file
in the hierarchical file system.
Pathnames are classified into Absolute path name and Relative path name.
1.Absolute path name
An absolute pathname is a path that describes the location of a file or folder from the root
directory(/).
Ex: usr/cse/myfile.txt

2.Relative pathname
A relative pathname is a path that describes the location of a file or folder in relative to the
current/present working directory(pwd).
Ex: Assuming that we are already present in cse directory then the relative path for the same
can be written as simple myfile.txt.

b) Deadlock in OS refers to a situation where more than one or two processes or threads are
not able to proceed because each is waiting for the other to release a resource. In other words,
it's a state where a group of processes become stuck in a way that they can't make any progress.
There are few methods for handling deadlocks in an operating system include,
Deadlock prevention:
A set of methods that ensure that at least one of the conditions for deadlock cannot occur. Ex
mutual exclusion, hold and wait, and no preemption are all deadlock prevention techniques.

Deadlock avoidance:
A technique that uses a safety algorithm and resource allocation graph to ensure the system is
always in a safe state. Ex the banker’s algorithm is a deadlock avoidance technique.

Deadlock detection:
A technique that uses a resource allocation graph(RAG) to detect deadlocks. A RAG is a visual
representation of the processes holding resources and their current allocation state.

Deadlock Detection and Recovery:


Detection methods help identify when this happens, and recovery techniques are used to
resolve these issues and restore system functionality. This ensures that computers and devices
can continue working without interruptions caused by deadlock situations. This can lead to a
system-wide stall, where no process can make progress.

SECTION-3
5.a)
Aspect Process Thread
Shares memory space with
Has its own separate
Memory Space other threads within the same
memory space.
process.
Higher overhead due to
Lower overhead, more efficient
Overhead separate memory and
in resource usage.
resource allocation.
Depends on the process;
Execution Operates independently. multiple threads can run in
parallel within one process.
Communicates through IPC Communicates directly through
Communication
mechanisms. shared memory.

Can be started, stopped, and Controlled within the context of


Control
controlled independently. a process.

Each process has its own


Resource Share resources of the process
resources (files, variables,
Allocation they belong to.
etc.).
Processes are isolated from Threads can directly affect each
Isolation
each other. other within the same process.
Failure in one process does A failure in one thread can
Failure Impact
not affect other processes. affect all threads of the process.

Longer creation time due to Shorter creation time since less


Creation Time
resource allocation. resource allocation is needed.

Ideal for tasks requiring


Suitable for applications
Use Case frequent communication and
needing isolated execution.
shared resources.

b) CPU SCHEDULERS:
First come, first served (FCFS)
A simple algorithm that executes processes in the order they arrive. However, it can cause the
“convoy effect” where shorter processes wait behind longer ones.
Priority scheduling
Assigns a priority to each process, and the process with highest priority gets the CPU first.
Priorities can be based on factors like the process’s importance, how long it’s been waiting, or
its resource requirements.

Multilevel queue scheduling


Processes are assigned to queues and remain in them until their CPU burst is complete. In
multilevel feedback queue scheduling, processes can move between queues.

Round robin(RR) scheduling


A technique for time-sharing systems that includes preemption to toggle between processes. A
small unit of time called a time quantum or time slice is defined, usually 10 to 100
milliseconds.

6) From start to finish, the process goes through a number of stages. A minimum of five states
is required. Even though the process could be in one of these states during execution, the
names of the states are not standarized. Throughout its life cycle, each process goes through
various stages. They are:

New State
When a program in secondary memory is started for execution, the process is said to be in a
new state.
Ready State
After being loaded into the main memory and ready for execution, a process transitions from a
new to a ready state. The process will now be in the ready state, waiting for the processor to
execute it. Many processes may be in the ready stage in a multiprogramming environment.
Run State
After being allotted the CPU for execution, a process passes from the ready state to the run
state.
Terminate State
When a process’s execution is finished, it goes from the run state to the terminate state. The
operating system deletes the process control box (or PCB) after it enters the terminate state.
Block or Wait State
If a process requires an Input/Output operation or a blocked resource during execution, it
changes from run to block or the wait state.
The process advances to the ready state after the I/O operation is completed or the resource
becomes available.
Suspend Ready State
If a process with a higher priority needs to be executed while the main memory is full, the
process goes from ready to suspend ready state. Moving a lower-priority process from the
ready state to the suspend ready state frees up space in the ready state for a higher-priority
process.
Until the main memory becomes available, the process stays in the suspend-ready state. The
process is brought to its ready state when the main memory becomes accessible.
Suspend Wait State
If a process with a higher priority needs to be executed while the main memory is full, the
process goes from the wait state to the suspend wait state. Moving a lower-priority process
from the wait state to the suspend wait state frees up space in the ready state for a higher-
priority process.
The process gets moved to the suspend-ready state once the resource becomes accessible. The
process is shifted to the ready state once the main memory is available.

You might also like