Skip to main content
  1. Resources/
  2. Study Materials/
  3. Information Technology Engineering/
  4. IT Semester 3/
  5. Linux Operating System (4331602)/

Linux Operating System (4331602) - Winter 2024 Solution

·
Study-Material Solutions Linux 4331602 2024 Winter
Milav Dabgar
Author
Milav Dabgar
Experienced lecturer in the electrical and electronic manufacturing industry. Skilled in Embedded Systems, Image Processing, Data Science, MATLAB, Python, STM32. Strong education professional with a Master’s degree in Communication Systems Engineering from L.D. College of Engineering - Ahmedabad.
Table of Contents

Question 1(a) [3 marks]
#

Explain Multiprogramming Operating System and give its advantages.

Answer:

Multiprogramming Operating System allows multiple programs to reside in memory simultaneously and execute concurrently by sharing CPU time efficiently.

Table: Multiprogramming System Features

FeatureDescription
Memory ManagementMultiple programs loaded in memory
CPU SchedulingCPU switches between programs
Resource SharingEfficient utilization of system resources
  • Increased CPU utilization: CPU remains busy switching between programs
  • Better throughput: More programs completed per unit time
  • Reduced response time: Programs execute faster due to parallel processing

Mnemonic: “MCP” - Memory sharing, CPU utilization, Parallel execution

Question 1(b) [4 marks]
#

Explain Characteristics of Linux operating system.

Answer:

Table: Linux Operating System Characteristics

CharacteristicDescription
Open SourceSource code freely available and modifiable
Multi-userMultiple users can access system simultaneously
Multi-taskingMultiple processes run concurrently
PortableRuns on various hardware platforms
SecurityStrong permission system and access controls
StabilityRobust and reliable system performance
  • Case sensitive: Distinguishes between uppercase and lowercase
  • Command line interface: Powerful shell for system operations
  • File system hierarchy: Organized directory structure starting from root (/)

Mnemonic: “LAMPS” - Linux is Accessible, Multi-user, Portable, Secure

Question 1(c) [7 marks]
#

Explain FCFS scheduling algorithm with its advantages and disadvantages. Calculate Average waiting time and average turnaround time for FCFS algorithm with gantt chart for following data.

Answer:

First Come First Serve (FCFS) is a non-preemptive scheduling algorithm where processes are executed in order of their arrival.

Table: FCFS Algorithm Analysis

AspectDescription
PolicyFirst arrived process gets CPU first
TypeNon-preemptive
ImplementationSimple queue (FIFO)

Advantages:

  • Simple implementation: Easy to understand and code
  • Fair scheduling: No starvation occurs

Disadvantages:

  • Convoy effect: Short processes wait for long processes
  • Poor average waiting time: Not optimal for system performance

Gantt Chart Calculation:

P005P18|1P02|17P3

Table: Process Execution Analysis

ProcessArrivalBurstStartFinishWaitingTurnaround
P0050505
P1335825
P25281035
P3671017411

Average Waiting Time = (0+2+3+4)/4 = 2.25 ms Average Turnaround Time = (5+5+5+11)/4 = 6.5 ms

Mnemonic: “FCFS-SiNo” - First Come First Serve is Simple but Not optimal


Question 1(c) OR [7 marks]
#

Explain Round Robin algorithm with its advantages and disadvantages. Calculate Average waiting time and average turnaround time for Round Robin algorithm with gantt chart for following data. (Time Quantum = 2 ms)

Answer:

Round Robin is a preemptive scheduling algorithm where each process gets equal CPU time slice (quantum).

Table: Round Robin Features

FeatureDescription
Time QuantumFixed time slice for each process
PreemptionProcess interrupted after quantum expires
Queue TypeCircular ready queue

Advantages:

  • Fair allocation: Each process gets equal CPU time
  • No starvation: All processes eventually get CPU

Disadvantages:

  • Context switching overhead: Frequent process switching
  • Performance depends on quantum: Too small or large affects efficiency

Gantt Chart (Quantum = 2ms):

P00|2P14|P62|7P39|P101|P112|P123|P114|P106|P1|

Table: Round Robin Execution

ProcessArrivalBurstCompletionWaitingTurnaround
P004141014
P115161015
P22312710
P331734

Average Waiting Time = (10+10+7+3)/4 = 7.5 ms Average Turnaround Time = (14+15+10+4)/4 = 10.75 ms

Mnemonic: “RR-TEQ” - Round Robin uses Time Equal Quantum


Question 2(a) [3 marks]
#

Explain Real Time Operation System.

Answer:

Real Time Operating System (RTOS) processes data and responds to events within strict time constraints.

Table: RTOS Types

TypeResponse TimeExample
Hard Real-timeGuaranteed deadlineMissile guidance
Soft Real-timeFlexible deadlineVideo streaming
  • Deterministic behavior: Predictable response times
  • Priority-based scheduling: Critical tasks get higher priority
  • Minimal latency: Fast interrupt handling and context switching

Mnemonic: “RTD” - Real Time is Deterministic

Question 2(b) [4 marks]
#

Explain Process Life Cycle with diagram.

Answer:

Process Life Cycle shows different states a process goes through during execution.

Diagram: Process State Transition

stateDiagram-v2
    [*] --> New : Create Process
    New --> Ready : Admitted
    Ready --> Running : Scheduler Dispatch
    Running --> Waiting : I/O Request
    Running --> Ready : Time Quantum Expired
    Running --> Terminated : Exit
    Waiting --> Ready : I/O Complete
    Terminated --> [*] : Process Cleanup

Table: Process States

StateDescription
NewProcess being created
ReadyWaiting for CPU assignment
RunningInstructions being executed
WaitingWaiting for I/O completion
TerminatedProcess finished execution

Mnemonic: “NRRWT” - New Ready Running Waiting Terminated

Question 2(c) [7 marks]
#

Explain Various file and directory related commands in Linux.

Answer:

Table: File Commands

CommandFunctionExample
lsList directory contentsls -la
catDisplay file contentcat file.txt
cpCopy filescp source dest
mvMove/rename filesmv old new
rmRemove filesrm file.txt

Table: Directory Commands

CommandFunctionExample
mkdirCreate directorymkdir mydir
rmdirRemove empty directoryrmdir mydir
cdChange directorycd /home
pwdPrint working directorypwd
  • File permissions: Use chmod to modify access rights
  • File ownership: Use chown to change file owner
  • File information: Use stat for detailed file information

Mnemonic: “LCCMR-MRCP” - List, Cat, Copy, Move, Remove for files; Make, Remove, Change, Print for directories


Question 2(a) OR [3 marks]
#

Describe operating system services in detail.

Answer:

Operating System Services provide interface between user applications and hardware resources.

Table: OS Services Categories

CategoryServices
User InterfaceGUI, Command Line, Batch
Program ExecutionLoading, Running, Terminating
I/O OperationsFile operations, Device communication
File SystemCreation, Deletion, Manipulation
CommunicationProcess communication, Network
Error DetectionHardware/Software error handling
  • Resource allocation: CPU, memory, and device management
  • Accounting: Track resource usage and performance
  • Protection and security: Access control and authentication

Mnemonic: “UPIFCE” - User interface, Program execution, I/O, File system, Communication, Error detection

Question 2(b) OR [4 marks]
#

Explain Process Control Block.

Answer:

Process Control Block (PCB) is a data structure containing all information about a process.

Table: PCB Components

ComponentInformation Stored
Process IDUnique process identifier
Process StateCurrent state (ready, running, waiting)
CPU RegistersProgram counter, stack pointer, registers
Memory ManagementBase/limit registers, page tables
I/O StatusOpen files, allocated devices
AccountingCPU usage, time limits

Diagram: PCB Structure

PPPCMOArrrPepcoooUmecccgonoeerRrussaeyFnssmgitiLliISCsienDtotmgaueiLtnrtiIetsssnetfro

Mnemonic: “PPCMIA” - Process ID, Process state, Program Counter, CPU registers, Memory, I/O, Accounting

Question 2(c) OR [7 marks]
#

Explain installation steps of Linux.

Answer:

Linux Installation involves preparing system and installing operating system from bootable media.

Table: Installation Steps

StepDescription
1. Download ISOGet Linux distribution image file
2. Create Bootable MediaUse USB/DVD to create installation media
3. Boot from MediaChange BIOS/UEFI boot order
4. Select LanguageChoose installation language
5. Partition DiskCreate root, swap, home partitions
6. Configure NetworkSet IP, DNS, hostname
7. Create User AccountSet username, password
8. Install BootloaderConfigure GRUB for booting
9. Complete InstallationRemove media and reboot

Partitioning Scheme:

  • Root (/): 20GB minimum for system files
  • Swap: 2x RAM size for virtual memory
  • Home (/home): Remaining space for user data

Post-installation:

  • Update system: sudo apt update && sudo apt upgrade
  • Install drivers: Graphics, network, audio drivers
  • Configure security: Firewall, user permissions

Mnemonic: “DCBSLNCIU” - Download, Create media, Boot, Select language, Layout disk, Network, Create user, Install bootloader, Update system


Question 3(a) [3 marks]
#

Define: Process, Program, Swapping

Answer:

Table: Basic Definitions

TermDefinition
ProcessProgram in execution with allocated resources
ProgramSet of instructions stored on disk
SwappingMoving processes between memory and disk
  • Process: Active entity with process ID, memory space, and execution state
  • Program: Passive entity, executable file stored in secondary storage
  • Swapping: Memory management technique to handle more processes than physical memory

Mnemonic: “PAP-MDS” - Process is Active Program; Program is instructions; Swapping is Memory-Disk transfer

Question 3(b) [4 marks]
#

List out various file operations and describe each of them.

Answer:

Table: File Operations

OperationDescriptionSystem Call
CreateMake new file with specified namecreat()
OpenPrepare file for reading/writingopen()
ReadRetrieve data from fileread()
WriteStore data to filewrite()
CloseFinish file access, release resourcesclose()
DeleteRemove file from file systemunlink()
SeekMove file pointer to specific positionlseek()
  • File attributes: Access permissions, timestamps, size information
  • File locking: Prevent concurrent access conflicts
  • Buffer management: Optimize I/O performance through caching

Mnemonic: “CORWCDS” - Create, Open, Read, Write, Close, Delete, Seek

Question 3(c) [7 marks]
#

Write a shell script to generate and print Fibonacci series.

Answer:

Fibonacci Series generates numbers where each number is sum of two preceding numbers.

Shell Script:

#!/bin/bash
# Fibonacci series generator

echo "Enter number of terms:"
read n

a=0
b=1

echo "Fibonacci Series:"
echo -n "$a $b "

for((i=2; i<n; i++))
do
    c=$((a + b))
    echo -n "$c "
    a=$b
    b=$c
done
echo

Table: Script Components

ComponentPurpose
#!/bin/bashShebang line specifying interpreter
read nAccept user input for number of terms
for loopIterate to generate sequence
ArithmeticCalculate next number in series

Output Example:

Enter number of terms: 8
Fibonacci Series: 0 1 1 2 3 5 8 13

Mnemonic: “FLAB” - Fibonacci uses Loop with Addition of Both previous numbers


Question 3(a) OR [3 marks]
#

List out types of scheduler and explain any one of them.

Answer:

Table: Types of Schedulers

Scheduler TypeFunction
Long-termSelects processes from job pool to ready queue
Short-termSelects process from ready queue for CPU
Medium-termHandles swapping between memory and disk

Short-term Scheduler (CPU Scheduler):

  • Frequency: Executes very frequently (milliseconds)
  • Function: Decides which process gets CPU next
  • Algorithms: FCFS, SJF, Round Robin, Priority
  • Goal: Maximize CPU utilization and throughput

Mnemonic: “LSM-JRC” - Long-term (Job), Short-term (Ready), Medium-term (swap Control)

Question 3(b) OR [4 marks]
#

List out various file attributes and describe each of them.

Answer:

Table: File Attributes

AttributeDescription
NameHuman-readable file identifier
TypeFile format (text, binary, executable)
SizeCurrent file size in bytes
LocationPhysical address on storage device
ProtectionAccess permissions (read, write, execute)
Time stampsCreation, modification, access times
OwnerUser who created the file

Permission Structure:

  • User (u): Owner permissions
  • Group (g): Group member permissions
  • Other (o): All other users permissions

Example: -rwxr-xr--

  • File type: regular file (-)
  • Owner: read, write, execute (rwx)
  • Group: read, execute (r-x)
  • Others: read only (r–)

Mnemonic: “NTSLPTO” - Name, Type, Size, Location, Protection, Time, Owner

Question 3(c) OR [7 marks]
#

Write a shell script to sum of 1 to 10 using while loop.

Answer:

While Loop continues execution as long as specified condition remains true.

Shell Script:

#!/bin/bash
# Sum of numbers 1 to 10 using while loop

echo "Calculating sum of 1 to 10:"

i=1
sum=0

while [ $i -le 10 ]
do
    sum=$((sum + i))
    echo "Adding $i, current sum: $sum"
    i=$((i + 1))
done

echo "Final sum of 1 to 10 is: $sum"

Table: Script Logic

ComponentPurpose
i=1Initialize counter variable
sum=0Initialize accumulator
while [ $i -le 10 ]Continue while i ≤ 10
sum=$((sum + i))Add current number to sum
i=$((i + 1))Increment counter

Output:

Calculating sum of 1 to 10:
Adding 1, current sum: 1
Adding 2, current sum: 3
...
Final sum of 1 to 10 is: 55

Mnemonic: “WICS” - While loop needs Initialize, Condition, Sum calculation


Question 4(a) [3 marks]
#

List out and explain condition for Deadlock to occur.

Answer:

Deadlock occurs when processes wait indefinitely for resources held by each other.

Table: Deadlock Conditions (Coffman Conditions)

ConditionDescription
Mutual ExclusionOnly one process can use resource at a time
Hold and WaitProcess holds resources while waiting for others
No PreemptionResources cannot be forcibly taken away
Circular WaitCircular chain of processes waiting for resources

All four conditions must be true simultaneously for deadlock to occur.

Example Scenario:

  • Process P1 holds Resource A, needs Resource B
  • Process P2 holds Resource B, needs Resource A
  • Both processes wait indefinitely

Mnemonic: “MHNC” - Mutual exclusion, Hold and wait, No preemption, Circular wait

Question 4(b) [4 marks]
#

List out File access methods. Explain any one.

Answer:

Table: File Access Methods

MethodDescription
Sequential AccessRead file from beginning to end
Direct AccessJump to any record directly
Index SequentialCombination of sequential and indexed access

Sequential Access Method:

  • Process: Read records one by one in order
  • Advantages: Simple implementation, efficient for batch processing
  • Disadvantages: Slow for specific record access
  • Use cases: Log files, data backup, streaming

Operations:

read_next() - Read next record
write_next() - Write next record  
reset() - Return to beginning

Mnemonic: “SDI” - Sequential (start to end), Direct (jump anywhere), Index (combined approach)

Question 4(c) [7 marks]
#

Describe Security measures in operating system.

Answer:

Operating System Security protects system resources from unauthorized access and threats.

Table: Security Mechanisms

MechanismDescription
AuthenticationVerify user identity (passwords, biometrics)
AuthorizationControl resource access permissions
Access Control ListsDefine who can access specific resources
EncryptionProtect data confidentiality
Audit LogsTrack system activities and access
FirewallsControl network traffic

Security Levels:

  • Physical security: Protect hardware and facilities
  • User authentication: Login credentials and biometrics
  • File permissions: Read, write, execute controls
  • Network security: Secure communication protocols

Threats Protection:

  • Malware: Antivirus software and sandboxing
  • Unauthorized access: Strong passwords and multi-factor authentication
  • Data breaches: Encryption and backup strategies

Mnemonic: “AAAEAF” - Authentication, Authorization, Access control, Encryption, Audit, Firewall


Question 4(a) OR [3 marks]
#

List out ways to deal with deadlock. Explain deadlock detection and recovery.

Answer:

Table: Deadlock Handling Methods

MethodApproach
PreventionEnsure at least one Coffman condition cannot hold
AvoidanceDynamically examine resource allocation state
Detection & RecoveryAllow deadlock, then detect and recover
IgnoreAssume deadlock never occurs (Ostrich algorithm)

Deadlock Detection:

  • Wait-for graph: Maintain graph of process dependencies
  • Detection algorithm: Periodically check for cycles in graph
  • Resource allocation graph: Track resource ownership and requests

Deadlock Recovery:

  • Process termination: Kill one or more deadlocked processes
  • Resource preemption: Take resources from processes
  • Rollback: Return processes to safe state using checkpoints

Mnemonic: “PADI” - Prevention, Avoidance, Detection, Ignore

Question 4(b) OR [4 marks]
#

List out File allocation methods. Explain any one.

Answer:

Table: File Allocation Methods

MethodDescription
ContiguousAllocate consecutive disk blocks
LinkedUse pointers to link scattered blocks
IndexedUse index block to store block addresses

Contiguous Allocation:

  • Structure: File occupies consecutive blocks on disk
  • Advantages: Fast access, simple implementation, good for sequential access
  • Disadvantages: External fragmentation, difficult to grow files
  • Directory entry: Contains starting address and length

Example: File “test.txt” starts at block 100, length 5 blocks Occupies blocks: 100, 101, 102, 103, 104

Mnemonic: “CLI” - Contiguous (consecutive), Linked (pointers), Indexed (table)

Question 4(c) OR [7 marks]
#

Describe program threats and system threats.

Answer:

Program Threats are malicious software that can harm system or data.

Table: Program Threats

Threat TypeDescription
VirusSelf-replicating code that infects other programs
WormStandalone malware that spreads across networks
Trojan HorseMalicious code disguised as legitimate software
Logic BombCode that triggers malicious action on specific event
BackdoorHidden access point bypassing normal authentication

System Threats target operating system and system resources.

Table: System Threats

Threat TypeDescription
Buffer OverflowOverflow input buffers to execute malicious code
Denial of ServiceOverwhelm system resources to make service unavailable
Privilege EscalationGain higher access privileges than authorized
Man-in-the-MiddleIntercept communication between two parties

Protection Strategies:

  • Antivirus software: Detect and remove malicious programs
  • Regular updates: Patch security vulnerabilities
  • Access controls: Limit user privileges and resource access
  • Network monitoring: Detect suspicious activities

Mnemonic: “VWTLB-BPDM” - Virus, Worm, Trojan, Logic bomb, Backdoor; Buffer overflow, Privilege escalation, DoS, Man-in-middle


Question 5(a) [3 marks]
#

Explain Inter Process Communication.

Answer:

Inter Process Communication (IPC) enables processes to exchange data and synchronize activities.

Table: IPC Mechanisms

MechanismDescription
PipesUnidirectional communication channel
Message QueuesStructured message passing
Shared MemoryCommon memory area for multiple processes
SemaphoresSynchronization using counters
SignalsSoftware interrupts for notification
  • Synchronous communication: Sender waits for receiver acknowledgment
  • Asynchronous communication: Sender continues without waiting
  • Buffering: Messages stored temporarily if receiver not ready

Mnemonic: “PMSSS” - Pipes, Message queues, Shared memory, Semaphores, Signals

Question 5(b) [4 marks]
#

Explain File structure used by Linux.

Answer:

Linux File System follows hierarchical directory structure starting from root directory.

Diagram: Linux File System Hierarchy

lccbsapitnpheaotsscstwsdhPouDimsceectruu1mreensts

Table: Important Directories

DirectoryPurpose
/Root directory, top of hierarchy
/binEssential user commands
/etcSystem configuration files
/homeUser home directories
/varVariable data (logs, mail)
/usrUser programs and utilities
/tmpTemporary files
  • Case sensitive: Distinguishes between File.txt and file.txt
  • No drive letters: Everything under single root directory
  • Mount points: External devices appear as subdirectories

Mnemonic: “BEHVUT” - Bin, Etc, Home, Var, Usr, Tmp

Question 5(c) [7 marks]
#

Explain operating system security policies and procedures.

Answer:

Security Policies define rules and guidelines for protecting system resources and data.

Table: Security Policy Components

ComponentDescription
Access Control PolicyWho can access what resources
Password PolicyRequirements for strong passwords
Audit PolicyWhat activities to monitor and log
Backup PolicyData backup and recovery procedures
Incident ResponseSteps to handle security breaches

Security Procedures:

Authentication Procedures:

  • Multi-factor authentication: Password + token/biometric
  • Password complexity: Minimum length, special characters
  • Account lockout: Temporary disable after failed attempts

Authorization Procedures:

  • Principle of least privilege: Minimum necessary access
  • Role-based access: Assign permissions based on job function
  • Regular review: Periodic audit of user permissions

Monitoring Procedures:

  • Log analysis: Review system and security logs
  • Intrusion detection: Monitor for unauthorized access
  • Vulnerability scanning: Identify security weaknesses

Mnemonic: “APABI” - Access control, Password, Audit, Backup, Incident response


Question 5(a) OR [3 marks]
#

Explain Critical section.

Answer:

Critical Section is code segment where process accesses shared resources that must not be accessed concurrently.

Table: Critical Section Properties

PropertyDescription
Mutual ExclusionOnly one process in critical section at a time
ProgressSelection of next process cannot be postponed indefinitely
Bounded WaitingLimit on number of times other processes enter critical section

Critical Section Structure:

do {
    entry_section();     // Request permission
    critical_section();  // Access shared resource
    exit_section();      // Release permission
    remainder_section(); // Other work
} while(true);

Solutions:

  • Peterson’s algorithm: Software solution for two processes
  • Semaphores: Hardware-supported synchronization
  • Mutex locks: Binary semaphore for mutual exclusion

Mnemonic: “MPB” - Mutual exclusion, Progress, Bounded waiting

Question 5(b) OR [4 marks]
#

Explain types of Linux file system.

Answer:

Linux File Systems organize and manage data storage on disk devices.

Table: Linux File System Types

File SystemDescription
ext4Fourth extended file system, most common
XFSHigh-performance journaling file system
BtrfsB-tree file system with advanced features
ZFSZettabyte file system with built-in RAID
NTFSWindows file system support
FAT32Simple file system for compatibility

ext4 Features:

  • Journaling: Faster recovery after system crash
  • Large file support: Files up to 16TB
  • Backwards compatibility: Can mount ext2/ext3 partitions
  • Extents: Improve performance for large files

File System Selection Factors:

  • Performance requirements: Speed vs reliability
  • File size limits: Maximum file and partition sizes
  • Compatibility needs: Cross-platform support

Mnemonic: “EXBZNF” - Ext4, XFS, Btrfs, ZFS, NTFS, FAT32

Question 5(c) OR [7 marks]
#

Explain need of protection mechanism and various protection domain.

Answer:

Protection Mechanism prevents processes from interfering with each other and system resources.

Need for Protection:

  • Resource sharing: Multiple users/processes access same resources
  • Error containment: Prevent bugs from affecting entire system
  • Security enforcement: Implement access control policies
  • System stability: Protect critical system components

Table: Protection Domains

Domain TypeDescription
User DomainLimited access rights for user processes
Kernel DomainFull access to system resources
System DomainIntermediate privileges for system services

Protection Mechanisms:

Hardware Protection:

  • Memory protection: Base and limit registers
  • CPU protection: Timer interrupts prevent infinite loops
  • I/O protection: Privileged instructions for device access

Software Protection:

  • Access control lists: Define resource permissions
  • Capability lists: Token-based access control
  • Domain switching: Change protection levels safely

Table: Access Rights

RightDescription
ReadView content of resource
WriteModify resource content
ExecuteRun program or enter directory
AppendAdd data without modifying existing
DeleteRemove resource from system

Mnemonic: “RECES-UKS” - Resource sharing, Error containment, Security; User domain, Kernel domain, System domain

Related

Linux Operating System (4331602) - Summer 2024 Solution
Study-Material Solutions Linux 4331602 2024 Summer
Linux Operating System (4331602) - Winter 2023 Solution
Study-Material Solutions Linux Operating-System 4331602 2023 Winter
Electronic Measurements & Instruments (4331102) - Winter 2024 Solution
Study-Material Solutions Electronic-Measurements 4331102 2024 Winter
Microprocessor & Microcontroller Systems (1333202) - Winter 2024 Solution
21 mins
Study-Material Solutions Microprocessor Microcontroller 8085 8051 1333202 2024 Winter
Data Structure with Python (4331601) - Winter 2024 Solution
Study-Material Solutions Data-Structure Python 4331601 2024 Winter
Embedded System (4343204) - Winter 2024 Solution
23 mins
Study-Material Solutions Embedded-System 4343204 2024 Winter