SS Lab Outputs Only PDF
SS Lab Outputs Only PDF
SOFTWARE
LAB
C
G Giridhar
CS-5-B
Roll No- 21
1
CONTENTS
1 CPU Scheduling Algorithms 2
2 File Organization 5
3 Banker’s Algorithm 10
11 Absolute Loader 21
Experiment 1 :
Simulate the following non-preemptive CPU scheduling algorithms to find turnaround
time and waiting time.
a) FCFS b) SJF c) Round Robin (pre-emptive) d) Priority
Output :
a) FCFS
Enter the number of processes : 5
b) SJF
Enter the number of processes : 5
3
c) RR
Enter the number of processes : 3
3 7 0 9 ms 16 ms
d) Priority Scheduling
Enter the number of processes : 4
Experiment 2:
Simulate the following file organization techniques
a) Single level directory b) Two level directory c) Hierarchical
Output :
Directory Files
D1
D2
Directory Files
D1 F1
D2
Directory Files
D1
D2
c) Hierarchical
You are in root directory.
1. show everything in this directory 2. change directory 3. go to parent directory
4. add new file 5. delete file 6. create new directory 7. delete directory 8. exit
6
Enter the Name:
D1
8
*D1*
Experiment 3 :
Implement the banker’s algorithm for deadlock avoidance.
Output :
Experiment 4:
Implement the producer-consumer problem using semaphores.
Output :
Enter the buffer size : 3
Enter your choice :-
1.Produce 2.Consume 3.Exit
Your choice : 1
Produced Item..
Number of produced items : 1
Number of consumed items : 0
Your choice : 1
Produced Item..
Number of produced items : 2
Number of consumed items : 0
Your choice : 2
Consumed Item..
Number of produced items : 2
Number of consumed items : 1
Your choice : 1
Produced Item..
Number of produced items : 3
Number of consumed items : 1
Your choice : 1
Produced Item..
Number of produced items : 4
Number of consumed items : 1
Your choice : 1
Buffer is full!!!!
Number of produced items : 4
Number of consumed items : 1
12
Your choice : 2
Consumed Item..
Number of produced items : 4
Number of consumed items : 2
Your choice : 2
Consumed Item..
Number of produced items : 4
Number of consumed items : 3
Your choice : 2
Consumed Item..
Number of produced items : 4
Number of consumed items : 4
Your choice : 2
Buffer is empty!!!!!
Number of produced items : 4
Number of consumed items : 4
Your choice : 3
13
Experiment 5 :
Write a program to simulate the working of the dining philosopher’s problem.
Output :
Enter the philosopher number(1-5) : 1
Enter the operation needed
1.Start Eating 2.Stop Eating 3.Exit
1
Philosopher 1 is eating!
Enter the philosopher number(1-5) : 4
Enter the operation needed
1.Start Eating 2.Stop Eating 3.Exit
1
Philosopher 4 is eating!
Enter the philosopher number(1-5) : 3
Enter the operation needed
1.Start Eating 2.Stop Eating 3.Exit
1
Philosopher 3 cannot eat
Enter the philosopher number(1-5) : 1
Enter the operation needed
1.Start Eating 2.Stop Eating 3.Exit
2
Philosopher 1 is thinking!
Enter the philosopher number(1-5) : 2
Enter the operation needed
1.Start Eating 2.Stop Eating 3.Exit
1
Philosopher 2 is eating!
Enter the philosopher number(1-5) : 3
Enter the operation needed
1.Start Eating 2.Stop Eating 3.Exit
14
Experiment 6 :
Simulate the following disk scheduling algorithms.
a) FCFS b)SCAN c) C-SCAN
Output :
DISK SCHEDULING
--------------------
Enter the range : 200
Enter the number of disk requests : 5
Enter the head position (< 200): 40
Enter the requests : 10 20 30 50 60
Experiment 7 :
Implement pass one of a two pass assembler.
Output :
Input.txt :
COPY START 1000
- LDA ALPHA
- ADD ONE
- SUB TWO
- STA BETA
ALPHA BYTE C'KLNCE
ONE RESB 2
TWO WORD 5
BETA RESW 1
- END -
Console :
COPY START 1000
Experiment 8:
Implement pass two of a two pass assembler.
Output :
Intermediate.txt :
COPY START 1000
Console :
H^COPY^1000^25
T^001000^001012^011017^051019^231022^7576786769^00005^
E^001000
18
Experiment 9:
Implement a single pass assembler.
Output :
Input.txt :
COPY START 1000
- LDA ALPHA
- STA BETA
ALPHA RESW 1
BETA RESW 1
- END -
Console :
H^COPY^1000^0c
T^001000^0c^000000^230000
T^1001^02^1006
T^1004^02^1009
E^001000%
19
Experiment 10 :
Implement a two pass macro processor.
Output :
Pass 1 :
Input.txt :
EX1 MACRO &A,&B
- LDA &A
- STA &B
- MEND -
SAMPLE START 1000
- EX1 N1,N2
N1 RESW 1
N2 RESW 1
- END -
Deftab.txt :
EX1 &A,&B
LDA &A
STA &B
MEND
Namtab.txt :
EX1
Pass 2 :
Input.txt :
EX1 MACRO &A,&B
- LDA &A
- STA &B
- MEND -
SAMPLE START 1000
- EX1 N1,N2
N1 RESW 1
N2 RESW 1
20
- END -
Output.txt :
SAMPLE START 1000
. EX1 N1,N2
- LDA N1
- STA N2
N1 RESW 1
N2 RESW 1
- END -
21
Experiment 11:
Implement an absolute loader.
Output :
Input.dat :
H COPY 001000 00107A
T 001000 1E 141033 482039 001036 281030 301015 482061 3C1003 00102A
0C1039 00102D
T 00101E 15 0C1036 482061 081033 4C0000 454F46 000003 000000
T 001047 1E 041030 001030 E0205D 30203F D8205D 281030 302057 549039
2C205E 38203F
T 001077 1C 101036 4C0000 000000 001000 041030 E02079 302064 509039
DC2079 2C1036
E 001000
Output.dat/Console :
----------------------------------------------------------------------------------------------
MEMORY ADDRESS CONTENTS
----------------------------------------------------------------------------------------------
Experiment 12 :
Implement a symbol table with suitable hashing.
Output :
5 0
6 6144 XYZ
7 0
8 0
9 0
10 0
Symbol Table Menu
1.Create a Symbol Table
2.Search in the Symbol Table
3.Exit
Enter your choice:2