Sie sind auf Seite 1von 11

OUTPUTS:

4a:
Mohammeds-MacBook-Pro:Desktop mohammedthawfeeq$ cc 4a.c
4a.c:2:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
main()
^
1 warning generated.
Mohammeds-MacBook-Pro:Desktop mohammedthawfeeq$ ./a.out
Enter no.of files:2
Enter no. of blocks occupied by file1 6
Enter the starting block of file1 8
Enter no. of blocks occupied by file2 7
Enter the starting block of file2 4
Filename Start block length
1 8 6
2 4 7
blocks occupied are:fileno1 8 9 10 11 12 13
fileno2 4 5 6 7 8 9 10

Mohammeds-MacBook-Pro:Desktop mohammedthawfeeq$

4b:
Mohammeds-MacBook-Pro:Desktop mohammedthawfeeq$ cc 4b.c
4b.c:7:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
main()
^
4b.c:15:12: warning: format specifies type 'char *' but the argument has
type 'char (*)[10]' [-Wformat]
scanf("%s",&f[i].fname);
~~ ^~~~~~~~~~~
2 warnings generated.
Mohammeds-MacBook-Pro:Desktop mohammedthawfeeq$ ./a.out
Enter no. of files: 2
Enter file name: mohammed
Enter starting block: 7
Enter no.of blocks: 8
Enter block numbers: 6
4
5
9
3
1
7
2
Enter file name: thawfeeq
Enter starting block: 4
Enter no.of blocks: 2
Enter block numbers: 8
7
File start size block
mohammed 7 8 7--->6--->4--->5--->9--->3--->1--->7--->2
thawfeeq 4 2 4--->8--->7
Mohammeds-MacBook-Pro:Desktop mohammedthawfeeq$

4c:
Mohammeds-MacBook-Pro:Desktop mohammedthawfeeq$ cc 4c.c
4c.c:2:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
main()
^
4c.c:8:32: warning: data argument not used by format string [-Wformat-
extra-args]
{ printf("Enter index block :",i+1);
~~~~~~~~~~~~~~~~~~~~~ ^
2 warnings generated.
Mohammeds-MacBook-Pro:Desktop mohammedthawfeeq$ ./a.out
Enter no. of files: 2
Enter index block : 4
Enter blocks occupied by file1: 6
enter blocks of file1: 1
3
5
7
9
0
Enter index block : 6
Enter blocks occupied by file2: 2
enter blocks of file2: 2
6

File index length


1 4 6
2 6 2
blocks occupied are: fileno1 4--->1
4--->3
4--->5
4--->7
4--->9
4--->0

fileno2 6--->2
6--->6

Mohammeds-MacBook-Pro:Desktop mohammedthawfeeq$

5:
Mohammeds-MacBook-Pro:Desktop mohammedthawfeeq$ cc 5.c
5.c:3:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
main()
^
5.c:30:1: warning: implicitly declaring library function 'exit' with type 'void
(int) __attribute__((noreturn))'
exit(0);
^
5.c:30:1: note: include the header <stdlib.h> or explicitly provide a declaration for
'exit'
2 warnings generated.
Mohammeds-MacBook-Pro:Desktop mohammedthawfeeq$ ./a.out

1.PRODUCER
2.CONSUMER
3.EXIT

ENTER YOUR CHOICE


1

producer produces the item1


ENTER YOUR CHOICE
1

producer produces the item2


ENTER YOUR CHOICE
2

consumer consumes item2


ENTER YOUR CHOICE
2

consumer consumes item1


ENTER YOUR CHOICE
2
BUFFER IS EMPTY
ENTER YOUR CHOICE
1

producer produces the item1


ENTER YOUR CHOICE
1

producer produces the item2


ENTER YOUR CHOICE
1

producer produces the item3


ENTER YOUR CHOICE
1
BUFFER IS FULL
ENTER YOUR CHOICE
2

consumer consumes item3


ENTER YOUR CHOICE
2

consumer consumes item2


ENTER YOUR CHOICE
2

consumer consumes item1


ENTER YOUR CHOICE
2
BUFFER IS EMPTY
ENTER YOUR CHOICE
3
Mohammeds-MacBook-Pro:Desktop mohammedthawfeeq$

7:
Mohammeds-MacBook-Pro:Desktop mohammedthawfeeq$ cc 7.c
7.c:2:1: warning: return type of 'main' is not 'int' [-Wmain-return-type]
void main(){
^
7.c:2:1: note: change return type to 'int'
void main(){
^~~~
int
1 warning generated.
Mohammeds-MacBook-Pro:Desktop mohammedthawfeeq$ ./a.out
enter the number of processes in a system 5
enter the number of resources in a system 6

enter the number of instances of resource R1 5

enter the number of instances of resource R2 4

enter the number of instances of resource R3 2

enter the number of instances of resource R4 3

enter the number of instances of resource R5 1

enter the number of instances of resource R6 7

Enter the allocation matrix


12
3
5
8
8
6

7
8
8
8
4
3

3
5
3
8
4
9

8
7
8
6
5
5

7
5
7
4
3
3

Enter the maximum matrix


7
4
3
3
2
2

9
0
2
2
2
2

9
0
2
4
3
3

5
9
5
4
3
3

6
8
6
7
5
5
pocess P1
allocated 12 maximum 7 need -5
allocated 3 maximum 4 need 1
allocated 5 maximum 3 need -2
allocated 8 maximum 3 need -5
allocated 8 maximum 2 need -6
allocated 6 maximum 2 need -4
_________________________
pocess P2
allocated 7 maximum 9 need 2
allocated 8 maximum 0 need -8
allocated 8 maximum 2 need -6
allocated 8 maximum 2 need -6
allocated 4 maximum 2 need -2
allocated 3 maximum 2 need -1
_________________________
pocess P3
allocated 3 maximum 9 need 6
allocated 5 maximum 0 need -5
allocated 3 maximum 2 need -1
allocated 8 maximum 4 need -4
allocated 4 maximum 3 need -1
allocated 9 maximum 3 need -6
_________________________
pocess P4
allocated 8 maximum 5 need -3
allocated 7 maximum 9 need 2
allocated 8 maximum 5 need -3
allocated 6 maximum 4 need -2
allocated 5 maximum 3 need -2
allocated 5 maximum 3 need -2
_________________________
pocess P5
allocated 7 maximum 6 need -1
allocated 5 maximum 8 need 3
allocated 7 maximum 6 need -1
allocated 4 maximum 7 need 3
allocated 3 maximum 5 need 2
allocated 3 maximum 5 need 2
_________________________

AvailabilityR1 -32 R2 -24 R3 -29 R4 -31 R5 -23 R6 -19


____________
safe sequenceMohammeds-MacBook-Pro:Desktop mohammedthawfeeq$

8a:
Mohammeds-MacBook-Pro:Desktop mohammedthawfeeq$ cc 8a.c
8a.c:3:1: warning: return type of 'main' is not 'int' [-Wmain-return-type]
void main()
^
8a.c:3:1: note: change return type to 'int'
void main()
^~~~
int
1 warning generated.
Mohammeds-MacBook-Pro:Desktop mohammedthawfeeq$ ./a.out

Program for paging


Enter the number of Pages: 3

Enter the base address: 1200


1400
1600

Enter the logical address: 1300

Enter the Page No: 1

Invalid page
PageNo. BaseAdd. PhysicalAdd.
1 1400 2700
Invalid pageMohammeds-MacBook-Pro:Desktop mohammedthawfeeq$

8b:
Mohammeds-MacBook-Pro:Desktop mohammedthawfeeq$ cc 8b.c
8b.c:3:1: warning: return type of 'main' is not 'int' [-Wmain-return-type]
void main()
^
8b.c:3:1: note: change return type to 'int'
void main()
^~~~
int
1 warning generated.
Mohammeds-MacBook-Pro:Desktop mohammedthawfeeq$ ./a.out

Program for segmentation


Enter the number of segments: 2

Enter the base address and limit register: 1000


5000
6000
7000

Enter the logical address:2000

Enter the segment no.:1

segmentNo. BaseAdd. PhysicalAdd.


1 6000 8000
Invalid segmentMohammeds-MacBook-Pro:Desktop mohammedthawfeeq$

9a:
Mohammeds-MacBook-Pro:Desktop mohammedthawfeeq$ cc 9a.c
9a.c:2:1: warning: return type of 'main' is not 'int' [-Wmain-return-type]
void main()
^
9a.c:2:1: note: change return type to 'int'
void main()
^~~~
int
1 warning generated.
Mohammeds-MacBook-Pro:Desktop mohammedthawfeeq$ ./a.out
Enter length of ref. string : 5
Enter reference string :
4
7
8
9
0
Enter number of frames : 6

Ref. str Page frames


4 4 -1 -1 -1 -1 -1
7 4 7 -1 -1 -1 -1
8 4 7 8 -1 -1 -1
9 4 7 8 9 -1 -1
0 4 7 8 9 0 -1

Total no. of page faults : 5


Mohammeds-MacBook-Pro:Desktop mohammedthawfeeq$

9b:
Mohammeds-MacBook-Pro:Desktop mohammedthawfeeq$ cc 9b.c
9b.c:2:1: warning: return type of 'main' is not 'int' [-Wmain-return-type]
void main()
^
9b.c:2:1: note: change return type to 'int'
void main()
^~~~
int
1 warning generated.
Mohammeds-MacBook-Pro:Desktop mohammedthawfeeq$ ./a.out
Enter no of pages: 4
Enter the reference string: 36
37
38
32
Enter no of frames: 4

36
36 37

36 37 38

36 37 38 32

The no of page faults is 32

Mohammeds-MacBook-Pro:Desktop mohammedthawfeeq$

9c:
Mohammeds-MacBook-Pro:Desktop mohammedthawfeeq$ cc 9c.c
9c.c:5:1: warning: return type of 'main' is not 'int' [-Wmain-return-type]
void main()
^
9c.c:5:1: note: change return type to 'int'
void main()
^~~~
int
1 warning generated.
Mohammeds-MacBook-Pro:Desktop mohammedthawfeeq$ ./a.out

OPTIMAL PAGE REPLACEMENT ALGORITHM


<<------------------------------------------------------------------>>
Enter the no.of frames 5
Enter the no.of reference string 2
Enter the reference string 32 34
OPTIMAL PAGE REPLACEMENT ALGORITHM
................................
The given string
....................
32 34

ref no 32 -> 32 -1 -1 -1 -1
ref no 34 -> 32 34 -1 -1 -1
Number of page faults: 2

Mohammeds-MacBook-Pro:Desktop mohammedthawfeeq$

10:
Mohammeds-MacBook-Pro:Desktop mohammedthawfeeq$ cc 10.c
10.c:4:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
main()
^
10.c:10:1: warning: implicitly declaring library function 'printf' with type
'int (const char *, ...)'
printf("\nfirst SHMID failed\n");
^
10.c:10:1: note: include the header <stdio.h> or explicitly provide a declaration
for 'printf'
2 warnings generated.
Mohammeds-MacBook-Pro:Desktop mohammedthawfeeq$ ./a.out

first SHMID succeded id=65536

secondt SHMID succeded id=65537

third SHMID succeded id=65538


Mohammeds-MacBook-Pro:Desktop mohammedthawfeeq$

11:
MEMORY MANAGEMENT USING PAGING

Enter the Size of Physical memory: 18

Enter the size of Logical memory: 9

Enter the partition size: 2

The physical memory is divided into 9 no.of frames


The Logical memory is divided into 4 no.of pages

Enter the Frame number where page 0 must be placed: 2

Enter the Frame number where page 1 must be placed: 7

Enter the Frame number where page 2 must be placed: 6

Enter the Frame number where page 3 must be placed: 5

PAGE TABLE

PageAddress FrameNo. PresenceBit

0 2 1
1 7 1
2 6 1
3 5 1

FRAME TABLE

FrameAddress PageNo

0 32555
1 32555
2 0
3 32555
4 32555
5 3
6 2
7 1
8 32555

Process to create the Physical Address

Enter the Base Address: 2000

Enter theLogical Address: 6

The Physical Address where the instruction present: 2010

Das könnte Ihnen auch gefallen