Linux Operating System (4331602) - Winter 2023 Solution (Gujarati)

Linux Operating System (4331602) Winter 2023 પરીક્ષા માટે સોલ્યૂશન ગાઈડ

પ્રશ્ન 1(a) [3 માર્ક્સ]

Linux ના આર્કિટેક્ચર દોરો અને સંક્ષિપ્તમાં વિવિધ સ્તરો સમજાવો.

જવાબ:

આકૃતિ:

  • User Space: વપરાશકર્તા applications અને system utilities સમાવે છે
  • System Call Interface: user programs અને kernel વચ્ચે interface પ્રદાન કરે છે
  • Kernel Space: process, memory, file management સાથે મૂળ operating system

મેમરી ટ્રીક: "Users System Kernel Drives Hardware"


પ્રશ્ન 1(b) [4 માર્ક્સ]

રેસની સ્થિતિ શું છે? યોગ્ય ઉદાહરણ સાથે સમજાવો.

જવાબ:

પાસુંવિવરણ
વ્યાખ્યાઅનેક processes એકસાથે shared resource ને access કરે છે
સમસ્યાtiming dependency ને કારણે અનિશ્ચિત પરિણામો
ઉદાહરણબે transactions દ્વારા બેંક account balance ને update કરવું

ઉદાહરણ પ્રક્રિયા:

  • Process A: balance = 1000 વાંચે છે, 100 ઉમેરે છે
  • Process B: balance = 1000 વાંચે છે, 50 બાદ કરે છે
  • પરિણામ: અંતિમ balance 1050, 950, અથવા 1100 હોઈ શકે યોગ્ય 1050 ને બદલે

મેમરી ટ્રીક: "Race Results Random Resources"


પ્રશ્ન 1(c) [7 માર્ક્સ]

વિવિધ પ્રકારની ઓપરેટિંગ સિસ્ટમોની યાદી બનાવો. મલ્ટિપ્રોગ્રામિંગ ઓપરેટિંગ સિસ્ટમના કાર્યને યોગ્ય ઉદાહરણ સાથે સમજાવો.

જવાબ:

કોષ્ટક: ઓપરેટિંગ સિસ્ટમના પ્રકારો

પ્રકારલક્ષણોઉદાહરણ
BatchJobs બેચમાં process થાય છેIBM mainframes
Time-sharingઅનેક વપરાશકર્તાઓ એકસાથેUNIX
Real-timeતાત્કાલિક response જરૂરીAir traffic control
Distributedઅનેક connected computersGoogle cluster
Multiprogrammingmemory માં અનેક programsWindows, Linux

Multiprogramming કાર્યપદ્ધતિ:

  • Memory Management: અનેક programs એકસાથે load થાય છે
  • CPU Scheduling: I/O occurrence દરમિયાન programs વચ્ચે switch કરે છે
  • Resource Sharing: CPU અને memory નો efficient ઉપયોગ
  • ઉદાહરણ: Word processor, music player, અને browser એકસાથે ચાલે છે

મેમરી ટ્રીક: "Multiple Programs Maximize Performance"


પ્રશ્ન 1(c OR) [7 માર્ક્સ]

વિવિધ પ્રકારની ઓપરેટિંગ સિસ્ટમોની યાદી બનાવો. બેચ ઓપરેટિંગ સિસ્ટમ્સ વિગતવાર સમજાવો.

જવાબ:

ઓપરેટિંગ સિસ્ટમના પ્રકારો: ઉપરનું કોષ્ટક સમાન.

Batch Operating System વિગતો:

  • Job Collection: Jobs offline collect થાય અને batches માં group થાય છે
  • Sequential Processing: Jobs એક પછી એક execute થાય વપરાશકર્તા interaction વગર
  • No Direct Interaction: વપરાશકર્તા job submit કરે અને પછીથી output collect કરે
  • Efficiency: સમાન પ્રકારના jobs માટે high throughput
  • ગેરફાયદા: Real-time processing નથી, લાંબો turnaround time

મેમરી ટ્રીક: "Batch Brings Better Business"


પ્રશ્ન 2(a) [3 માર્ક્સ]

પ્રક્રિયા જીવન ચક્ર દોરો અને સમજાવો.

જવાબ:

આકૃતિ:

  • New: પ્રક્રિયા બનાવવામાં આવે છે
  • Ready: પ્રક્રિયા CPU assignment માટે રાહ જોતી છે
  • Running: પ્રક્રિયા હાલમાં execute થઈ રહી છે
  • Waiting: પ્રક્રિયા I/O operation માટે રાહ જોતી છે
  • Terminated: પ્રક્રિયાએ execution પૂર્ણ કર્યું છે

મેમરી ટ્રીક: "New Ready Running Waiting Terminated"


પ્રશ્ન 2(b) [4 માર્ક્સ]

ડેડલોકને વ્યાખ્યાયિત કરો અને ડેડલોક થવા માટે જરૂરી શરતોની ચર્ચા કરો.

જવાબ:

વ્યાખ્યા: ડેડલોક ત્યારે થાય છે જ્યારે processes અન્ય processes દ્વારા held resources માટે અનિશ્ચિત સમય સુધી રાહ જોતી રહે છે.

કોષ્ટક: ડેડલોક શરતો

શરતવિવરણ
Mutual ExclusionResources share કરી શકાતા નથી
Hold and WaitProcess resource hold કરીને બીજા માટે રાહ જુએ છે
No PreemptionResources જબરદસ્તીથી લઈ શકાતા નથી
Circular WaitProcesses resource dependencies નું circular chain બનાવે છે

મેમરી ટ્રીક: "My Hold Never Circles"


પ્રશ્ન 2(c) [7 માર્ક્સ]

રાઉન્ડ રોબિન અલ્ગોરિધમનું વર્ણન કરો. આપેલ ડેટા માટે ગેન્ટ ચાર્ટ સાથે સરેરાશ રાહ જોવાનો સમય અને સરેરાશ ટર્ન-અરાઉન્ડ સમયની ગણતરી કરો. સંદર્ભ સ્વિચ = 01 ms અને ક્વોન્ટમ સમય = 05 ms ધ્યાનમાં લો.

જવાબ:

Round Robin અલ્ગોરિધમ:

  • Time Quantum: દરેક process માટે fixed time slice
  • Preemptive: Quantum expire થયા પછી process preempt થાય છે
  • Fair Scheduling: સમાન CPU time વિતરણ

આપેલ ડેટા:

  • Context Switch = 1 ms, Quantum = 5 ms

ગેન્ટ ચાર્ટ:

|P1|CS|P2|CS|P3|CS|P4|CS|P1|CS|P3|CS|P1|CS|P3|CS|
0  5  6 10 11 16 17 22 23 28 29 34 35 40 41 46 47

ગણતરી કોષ્ટક:

ProcessArrivalBurstCompletionTurnaroundWaiting
P1012404028
P2341073
P3215464429
P455221712
  • સરેરાશ Waiting Time: (28+3+29+12)/4 = 18 ms
  • સરેરાશ Turnaround Time: (40+7+44+17)/4 = 27 ms

મેમરી ટ્રીક: "Round Robin Rotates Regularly"


પ્રશ્ન 2(a OR) [3 માર્ક્સ]

તફાવત: CPU બાઉન્ડ પ્રક્રિયા v/s I/O બાઉન્ડ પ્રક્રિયા.

જવાબ:

કોષ્ટક: CPU vs I/O બાઉન્ડ પ્રક્રિયાઓ

પાસુંCPU બાઉન્ડI/O બાઉન્ડ
CPU વપરાશઉચ્ચ CPU utilizationનીચો CPU utilization
I/O Operationsન્યૂનતમ I/Oવારંવાર I/O
ઉદાહરણોગાણિતિક ગણતરીઓFile operations
Schedulingલાંબા time quantum ની જરૂરટૂંકા quantum થી ફાયદો
PerformanceCPU speed થી મર્યાદિતI/O speed થી મર્યાદિત

મેમરી ટ્રીક: "CPU Computes, I/O Interacts"


પ્રશ્ન 2(b OR) [4 માર્ક્સ]

ક્રિટિકલ સેક્શનને વ્યાખ્યાયિત કરો અને ક્રિટિકલ સેક્શન સોલ્યુશનની સામાન્ય રચનાની ચર્ચા કરો.

જવાબ:

વ્યાખ્યા: ક્રિટિકલ સેક્શન એ code segment છે જ્યાં shared resources ને access કરવામાં આવે છે અને atomically execute થવું જ જોઈએ.

કોષ્ટક: ક્રિટિકલ સેક્શન સ્ટ્રક્ચર

વિભાગહેતુ
Entry Sectionક્રિટિકલ સેક્શનમાં પ્રવેશ માટે permission માંગે છે
Critical SectionShared resources ને access કરતો કોડ
Exit SectionPermission રિલીઝ કરે છે
Remainder SectionShared resources access કરતો નથી તે બીજો કોડ

Solution Requirements:

  • Mutual Exclusion: ક્રિટિકલ સેક્શનમાં ફક્ત એક જ process
  • Progress: આગળની process ની selection અનિશ્ચિત સમય સુધી postpone થઈ શકતી નથી
  • Bounded Waiting: Waiting time પર મર્યાદા

મેમરી ટ્રીક: "Enter Critical Exit Remainder"


પ્રશ્ન 2(c OR) [7 માર્ક્સ]

SJF અલ્ગોરિધમનું વર્ણન કરો. કોષ્ટકમાં આપેલ ડેટા માટે ગેન્ટ ચાર્ટ સાથે સરેરાશ રાહ જોવાનો સમય અને સરેરાશ ટર્ન-અરાઉન્ડ સમયની ગણતરી કરો.

જવાબ:

SJF અલ્ગોરિધમ:

  • Shortest Job First: સૌથી નાના burst time વાળી process પહેલાં schedule થાય
  • Non-preemptive: Process completion સુધી ચાલે છે
  • Optimal: સરેરાશ waiting time ને minimize કરે છે

Execution Order: P2(4), P4(5), P1(8), P3(9)

ગેન્ટ ચાર્ટ:

|  P1  |  P2  |  P4  |     P3     |
0      8     12     17          26

ગણતરી કોષ્ટક:

ProcessArrivalBurstStartCompletionTurnaroundWaiting
P1080880
P23481295
P35917262112
P4651217116
  • સરેરાશ Waiting Time: (0+5+12+6)/4 = 5.75 ms
  • સરેરાશ Turnaround Time: (8+9+21+11)/4 = 12.25 ms

મેમરી ટ્રીક: "Shortest Jobs Start Soon"


પ્રશ્ન 3(a) [3 માર્ક્સ]

બે-સ્તરની ડિરેક્ટરી રચના સમજાવો.

જવાબ:

આકૃતિ:

goat
  • Master File Directory: દરેક વપરાશકર્તા માટે entries સમાવે છે
  • User File Directory: દરેક વપરાશકર્તાની files માટે અલગ directory
  • Path Structure: /user/filename
  • ફાયદા: Naming conflicts ને ઉકેલે છે, user isolation પ્રદાન કરે છે

મેમરી ટ્રીક: "Two Tiers Tackle Troubles"


પ્રશ્ન 3(b) [4 માર્ક્સ]

વિવિધ ફાઇલ કામગીરી સમજાવો.

જવાબ:

કોષ્ટક: ફાઇલ ઓપરેશન્સ

ઓપરેશનહેતુઉદાહરણ
Createનવી file બનાવવીtouch file.txt
Openઓપરેશન્સ માટે file ને access કરવીfopen()
ReadFile માંથી data retrieve કરવોfread()
WriteFile માં data store કરવોfwrite()
CloseFile access ને terminate કરવીfclose()
DeleteFile ને remove કરવીrm file.txt

મેમરી ટ્રીક: "Create Open Read Write Close Delete"


પ્રશ્ન 3(c) [7 માર્ક્સ]

વિવિધ ફાઈલ ફાળવણી પદ્ધતિઓની યાદી બનાવો અને જરૂરી રેખાકૃતિ સાથે સંલગ્ન ફાળવણી સમજાવો.

જવાબ:

ફાઇલ ફાળવણી પદ્ધતિઓ:

  • Contiguous Allocation
  • Linked Allocation
  • Indexed Allocation

સંલગ્ન ફાળવણી:

આકૃતિ:

goat

કોષ્ટક: સંલગ્ન ફાળવણી

પાસુંવિવરણ
StorageFiles consecutive blocks માં store થાય છે
Accessકોઈપણ block ને direct access
ફાયદાઝડપી access, સરળ implementation
ગેરફાયદાExternal fragmentation, expansion મુશ્કેલ

Directory Entry: (Start block, Length)

મેમરી ટ્રીક: "Contiguous Creates Continuous Clusters"


પ્રશ્ન 3(a OR) [3 માર્ક્સ]

ફાઇલ સ્ટ્રક્ચરના પ્રકારોનું વર્ણન કરો.

જવાબ:

કોષ્ટક: ફાઇલ સ્ટ્રક્ચર પ્રકારો

પ્રકારસંગઠનAccess
SequentialRecords ક્રમમાંSequential જ
Direct/RandomRecords key દ્વારાDirect access
IndexedIndex records ને point કરે છેKey-based access
HierarchicalTree structurePath-based

મેમરી ટ્રીક: "Sequential Direct Indexed Hierarchical"


પ્રશ્ન 3(b OR) [4 માર્ક્સ]

વિવિધ ફાઇલ લક્ષણો સમજાવો.

જવાબ:

કોષ્ટક: ફાઇલ લક્ષણો

લક્ષણવિવરણઉદાહરણ
Nameફાઇલ identifierdocument.txt
Typeફાઇલ format.txt, .exe
Sizeફાઇલ length bytes માં1024 bytes
LocationPhysical storage addressBlock 150
PermissionsAccess rightsrwx-rwx-rwx
TimestampsCreation, modification dates2023-01-16

મેમરી ટ્રીક: "Name Type Size Location Permissions Time"


પ્રશ્ન 3(c OR) [7 માર્ક્સ]

વિવિધ ફાઈલ ફાળવણી પદ્ધતિઓની યાદી બનાવો અને જરૂરી રેખાકૃતિ સાથે લિંક કરેલ ફાળવણી સમજાવો.

જવાબ:

ફાઇલ ફાળવણી પદ્ધતિઓ: અગાઉના જવાબ સમાન.

લિંક્ડ ફાળવણી:

આકૃતિ:

goat

કોષ્ટક: લિંક્ડ ફાળવણી

પાસુંવિવરણ
StorageFiles linked blocks માં store થાય છે
Pointersદરેક block આગળના block નું pointer સમાવે છે
ફાયદાExternal fragmentation નથી, dynamic size
ગેરફાયદાSequential access જ, pointer overhead

Directory Entry: (Start block pointer)

મેમરી ટ્રીક: "Links Lead Logical Locations"


પ્રશ્ન 4(a) [3 માર્ક્સ]

પ્રોગ્રામ ધમકીઓ વ્યાખ્યાયિત કરો અને તેના પ્રકારો સમજાવો.

જવાબ:

વ્યાખ્યા: પ્રોગ્રામ ધમકીઓ એ malicious programs છે જે system security અને integrity ને સાપે છે.

કોષ્ટક: પ્રોગ્રામ ધમકીના પ્રકારો

પ્રકારવિવરણ
Trojan HorseLegitimate program માં છુપાયેલો malicious code
Virusઅન્ય programs ને infect કરતો self-replicating code
WormNetworks વચ્ચે replicate થતો standalone program
Logic BombSpecific conditions દ્વારા trigger થતો code

મેમરી ટ્રીક: "Trojans Viruses Worms Logic-bombs"


પ્રશ્ન 4(b) [4 માર્ક્સ]

સિસ્ટમ ઓથેન્ટિકેશન સમજાવો.

જવાબ:

વ્યાખ્યા: System access આપતાં પહેલાં વપરાશકર્તાની identity ને verify કરવાની પ્રક્રિયા.

કોષ્ટક: ઓથેન્ટિકેશન પદ્ધતિઓ

પદ્ધતિવિવરણઉદાહરણ
PasswordSecret text stringusername/password
BiometricPhysical characteristicsFingerprint, retina
TokenPhysical deviceSmart card, USB key
Multi-factorપદ્ધતિઓનું combinationPassword + OTP

ઓથેન્ટિકેશન પ્રક્રિયા:

  • Identification: વપરાશકર્તા identity claim કરે છે
  • Verification: System claim ને validate કરે છે
  • Authorization: Access rights આપવામાં આવે છે

મેમરી ટ્રીક: "Passwords Biometrics Tokens Multi-factor"


પ્રશ્ન 4(c) [7 માર્ક્સ]

એક્સેસ કંટ્રોલ લિસ્ટને વિગતવાર સમજાવો.

જવાબ:

વ્યાખ્યા: ACL દરેક user/group માટે system resources પર permissions specify કરે છે.

કોષ્ટક: ACL કમ્પોનન્ટ્સ

કમ્પોનન્ટહેતુઉદાહરણ
SubjectUser અથવા groupjohn, admin_group
ObjectResourcefile.txt, directory
PermissionAllowed operationsread, write, execute
ActionAllow અથવા denypermit, deny

ACL સ્ટ્રક્ચર:

User: john    File: /etc/passwd    Permission: read    Action: allow
Group: users  File: /tmp/*        Permission: write   Action: allow
User: guest   File: /etc/*        Permission: write   Action: deny

ફાયદા:

  • Granular Control: Fine-grained permissions
  • Flexibility: Per-resource access control
  • Scalability: જટિલ organizations ને handle કરે છે

મેમરી ટ્રીક: "Access Controls Limit Users"


પ્રશ્ન 4(a OR) [3 માર્ક્સ]

સિસ્ટમ ધમકીઓ વ્યાખ્યાયિત કરો અને તેના પ્રકારો સમજાવો.

જવાબ:

વ્યાખ્યા: સિસ્ટમ ધમકીઓ operating system components અને system integrity ને target કરે છે.

કોષ્ટક: સિસ્ટમ ધમકીના પ્રકારો

પ્રકારવિવરણ
Denial of ServiceSystem resources ને overwhelm કરવા
Privilege EscalationUnauthorized higher privileges મેળવવા
Buffer OverflowMemory management flaws ને exploit કરવા
RootkitDetection થી malicious activities ને છુપાવવા

મેમરી ટ્રીક: "Denial Privilege Buffer Rootkit"


પ્રશ્ન 4(b OR) [4 માર્ક્સ]

OS માં રક્ષણની જરૂરિયાતો અને લક્ષ્યોની ચર્ચા કરો.

જવાબ:

કોષ્ટક: રક્ષણની જરૂરિયાતો અને લક્ષ્યો

જરૂરિયાતલક્ષ્યImplementation
ConfidentialityUnauthorized access અટકાવવાAccess controls
IntegrityData accuracy જાળવવાChecksums, validation
AvailabilityResource access ensure કરવાRedundancy, backup
AuthenticationUser identity verify કરવાLogin mechanisms

રક્ષણ પદ્ધતિઓ:

  • Access Control: Resource access ને limit કરવા
  • Capability Lists: User permissions define કરવા
  • Security Domains: Processes ને isolate કરવા

મેમરી ટ્રીક: "Confidentiality Integrity Availability Authentication"


પ્રશ્ન 4(c OR) [7 માર્ક્સ]

વિવિધ ઓપરેટિંગ સિસ્ટમ સુરક્ષા નીતિઓ અને પ્રક્રિયાઓની ચર્ચા કરો.

જવાબ:

કોષ્ટક: સુરક્ષા નીતિઓ અને પ્રક્રિયાઓ

નીતિ પ્રકારવિવરણપ્રક્રિયા
Access ControlUser permissions define કરવાRegular audit, role-based access
Password PolicyPassword requirementsComplexity rules, expiration
Backup PolicyData protection strategyRegular backups, testing
Incident ResponseSecurity breach handlingDetection, containment, recovery

સુરક્ષા પ્રક્રિયાઓ:

  • Regular Updates: Patch management
  • Monitoring: Log analysis, intrusion detection
  • Training: User security awareness
  • Audit: Compliance checking

મેમરી ટ્રીક: "Access Password Backup Incident"


પ્રશ્ન 5(a) [3 માર્ક્સ]

નીચેના આદેશો સમજાવો: (i) pwd (ii) cd (iii) comm

જવાબ:

કોષ્ટક: Linux Commands

Commandહેતુઉદાહરણ
pwdPresent working directory print કરવાpwd → /home/user
cdDirectory change કરવાcd /tmp
commSorted files ને compare કરવાcomm file1.txt file2.txt
  • pwd: હાલની directory નો path દર્શાવે છે
  • cd: Directories વચ્ચે navigate કરવા
  • comm: Files વચ્ચે common અને unique lines દર્શાવે છે

મેમરી ટ્રીક: "Print Working Directory, Change Directory, Compare Common"


પ્રશ્ન 5(b) [4 માર્ક્સ]

ત્રીજી ફાઇલમાં બે ફાઇલોના સમાવિષ્ટોને જોડવા માટે શેલ સ્ક્રિપ્ટ લખો.

જવાબ:

શેલ સ્ક્રિપ્ટ:

Bash

મેમરી ટ્રીક: "Cat Combines Content Correctly"


પ્રશ્ન 5(c) [7 માર્ક્સ]

આપેલ 5 અંકની સંખ્યામાં તમામ વ્યક્તિગત અંકોનો સરવાળો શોધવા માટે શેલ સ્ક્રિપ્ટ લખો.

જવાબ:

શેલ સ્ક્રિપ્ટ:

Bash

અલ્ગોરિધમ:

  • Input Validation: 5-digit number માટે ચેક કરો
  • Digit Extraction: Modulo operation વાપરો
  • Sum Calculation: દરેક digit ઉમેરો
  • Display Result: અંતિમ sum બતાવો

મેમરી ટ્રીક: "Sum Separates Single Symbols"


પ્રશ્ન 5(a OR) [3 માર્ક્સ]

નીચેના આદેશો સમજાવો: (i) man (ii) mkdir (iii) grep

જવાબ:

કોષ્ટક: Linux Commands

Commandહેતુઉદાહરણ
manManual pages દર્શાવવાman ls
mkdirDirectories બનાવવાmkdir newdir
grepText patterns શોધવાgrep "hello" file.txt
  • man: Commands માટે documentation પ્રદાન કરે છે
  • mkdir: Specified names સાથે નવી directories બનાવે છે
  • grep: Regular expressions વાપરીને files માં patterns શોધે છે

મેમરી ટ્રીક: "Manual Make Directories, Grep Examines Patterns"


પ્રશ્ન 5(b OR) [4 માર્ક્સ]

ફિબોનાચી શ્રેણી જનરેટ કરવા અને પ્રદર્શિત કરવા માટે શેલ સ્ક્રિપ્ટ લખો.

જવાબ:

શેલ સ્ક્રિપ્ટ:

Bash

મેમરી ટ્રીક: "Fibonacci Follows Forward Formula"


પ્રશ્ન 5(c OR) [7 માર્ક્સ]

આપેલ string palindrome છે કે કેમ તે નિર્ધારિત કરવા માટે શેલ સ્ક્રિપ્ટ લખો.

જવાબ:

શેલ સ્ક્રિપ્ટ:

Bash

અલ્ગોરિધમ:

  • String Cleaning: Lowercase માં convert કરો, spaces દૂર કરો
  • Character Comparison: બન્ને છેડાથી characters ને compare કરો
  • Palindrome Check: બધી comparisons match થાય છે કે કેમ verify કરો

મેમરી ટ્રીક: "Palindromes Proceed Perfectly Parallel"