0% found this document useful (0 votes)
7 views23 pages

OS Project Phase 1

The document outlines the structure and operations of a virtual machine, including memory organization, instruction sets, and programming examples. It details how data is read from input devices and printed to output devices, along with specific instructions for data manipulation. Additionally, it provides algorithms for executing user programs and handling system interrupts within the operating system framework.

Uploaded by

Yuvraj Inamdar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views23 pages

OS Project Phase 1

The document outlines the structure and operations of a virtual machine, including memory organization, instruction sets, and programming examples. It details how data is read from input devices and printed to output devices, along with specific instructions for data manipulation. Additionally, it provides algorithms for executing user programs and handling system interrupts within the operating system framework.

Uploaded by

Yuvraj Inamdar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

Course Project

Operating System
Operating System-Phase 1
• Virtual Machine
• Instruction Set
• Job
• Program Execution
• Algorithm
• Programming
• Output
Address Memory Location Content
Virtual Machine: 00
CPU 01
R 02
03
IR
:
IC

Card Line
Reader Printer
Virtual Machine :
1. 1 word =4 Bytes
Size of total Memory= 100 words=100 x 4 Bytes =400Bytes
2. Memory is divided into Blocks/Pages
Size of Block (Page)= 10 words =10 x 4 Bytes of each word=40 Bytes.
3. No of pages (Blocks) in memory= Size of Total Memory/ Size of one page
= 100 words/10 words
= 10 Pages.
10 Pages – (0 Page - 9 Page)
4. Card Reader(Input device) read Block of Data /Page -(40 Bytes)
5. Line Printer (Output device) print Block of Data /Page -(40 Bytes)
Virtual Machine Instructions:
SR.No. Instruction Operation Example Data Modes
1 GD Get Data from card reader and placed memory GD10,GD20 Block of data Master/Kernel
location specified in instruction (40 Bytes) Mode
2 PD Put (print data) to Line Printer from memory PD10,PD20 Block of data Master/Kernel
location content specified in instruction. (40 Bytes) Mode

3 LR Load Register with memory location content LR12,LR20 Word of data Slave/User
specified in instruction (4 Bytes) Mode
4 SR Store Register content to memory location SR24,SR50 Word of data Slave/User
specified in instruction. (4 Bytes) Mode
5 CR Compare register content with memory CR20,CR45 Word of data Slave/User
location content specified in instruction. (4 Bytes) Mode
Comparison result is equal- C-True
Comparison result is not equal-C-False
6 BT Branch to specified memory location in BT23 Byte data Slave/User
instruction if toggle register is true. (Toggle Reg.) Mode
7 HLT Stop execution of program. HLT - Master/Kernel
Mode
Virtual Machine Instructions:
Note: GD and PD are I/O instruction. It works on BLOCK of data(40 Bytes)
1. GD-Get data from Card Reader and placed specify memory location in
instruction.
e.g. GD10 – Get Data from Card Reader and placed data at specified memory
location 10.

2. PD- Put (Print ) data to Line Printer. Get the data from specified memory
location in instruction and put data to Line Printer.
e.g. PD10-Fetch (Block) of data from memory location 10 and put data to line
printer.
Virtual Machine Instructions:
Note: LR and SR (4 Bytes)perform word data transfer operation
3. LR-Load Register content from specified memory location in instruction.
e.g. LR 20- Load data(Word data) into register from memory location 20
LR 23

4. SR-Store Register content to specified memory location in instruction.


e.g. SR 40-Store content of register into memory location 40
SR 45
Virtual Machine Instructions:
Note: Compare instruction works on word data.
5. CR-Compare Register content with Memory location content specified in
instruction. Result of comparison-Set/Reset (true/false)store in Toggle C register.
e.g. CR 30 –Compare the content of register with memory location 30
Result –C-T/F (1/0)
CR 25

6. BT-Branch if true (C Flag status) to specify memory location in instruction


e.g. BT25 –Branch to memory location 25 if C(toggle register ) is true.

7. H-HLT –Stop Program Execution.


Virtual Machine Program: Address Memory Location
Content
Q. Write an program to display Hello 00 G D 1 0
message through Line Printer.
01 P D 1 0
$AMJ000100030001 02 H
; ( Job id /Total Time Limit /Total Line Limit) 03
GD10PD10H :
09
$DTA
10 H e l l
Hello
11 o
$END0001 12
:
19
:
99
Address Memory Location Content
Virtual Machine Program: 00
Q. Write an program to display following 01
message through Line Printer.
02
I LIKE THIS PEN OF HIS 03
Assume Data Card consist following data: :
I LIKE THIS PEN OF 09
10 I L I
11 K E T
12 H I S
13 P E N
14 O F
15
:
99
Address Memory Location Content
Virtual Machine Program: 00 G D 1 0
Q. Write an program to display following 01 L R 1 2
message through Line Printer.
02 S R 1 5
I LIKE THIS PEN OF HIS 03 P D 1 0
Assume Data Card consist following data: 04 H
I LIKE THIS PEN OF :
Ans: 09
$AMJ000200050001 10 I L I
GD10LR12SR15PD10H 11 K E T

$DTA 12 H I S
13 P E N
I LIKE THIS PEN OF
14 O F
$END0002
15 H I S
:
99
Address Memory Location Content
Virtual Machine Program: 00
Q. Write an program to compare data from 01
data card given in the program.
02
Assume Data Cards consist following data: 03
ABCD :
ABCD 09
DO NOT 10
MATCH 11
12

Output: 13
14
ABCD
15
ABCD
MATCH
99
Addr Memory Location
Virtual Machine Program: ess Content
Q. Write an program to compare strings given in the 00
program. 01
Ans. 02
$AMJ000300130003 03
GD20PD20GD30PD30GD40GD50LR20CR30BT11PD40 :
HPD50H 09
$DTA 10

ABCD 11
12
ABCD
13
DO NOT
14
MATCH
15
$END0003
99
Address Memory Location Content
Virtual Machine Program: 00
Q. Write an program to compare data from 01
data card given in the program.
02
Assume Data Cards consist following data: 03
VIT :
VIIT 09
IS SAME 10
NOT SAME 11
Output: 12

VIT 13
14
VIIT
15
NOT SAME

99
Addr Memory Location
Virtual Machine Program: ess Content
Q. Write an program to compare two sting VIT and 00
VIIT given in the program. 01
Ans: 02
$AMJ000400120003 03

GD20PD20GD30PD30GD40GD50LR20CR30BT11PD40 :
09
HPD50H
10
$DTA
11
VIT
12
VIIT
13
IS SAME 14
NOT SAME 15
$END0004
99
Algorithm:
Program:
1. Input File
2. Operating System Program
3. Output File
Algorithm:
ASSUMPTIONS:
• Jobs entered without error in input file
• No physical separation between jobs
• Job outputs separated in output file by 2 blank lines
• Program loaded in memory starting at location 00
• No multiprogramming, load and run one program at a time
• SI interrupt for service request
Algorithm:
NOTATION
M: memory; IR: Instruction Register (4 bytes)
IR [0, 1]: Bytes 1, 2 of IR/Operation Code
IR [2, 3]: Bytes 3, 4 of IR/Operand Address
M[&]: Content of memory location &
IC: Instruction Counter Register (2 bytes)
R: General Purpose Register (4 bytes)
C: Toggle (1 byte)
: Loaded/stored/placed into
Algorithm:
LOAD
m0
While not e-o-f
Read next (program or control) card from input file in a buffer
Control card: $AMJ, INIT
$DTA, START EXECUTION
$END, end-while
Program Card: Store buffer in memory locations m through m + 9
m  m + 10
End-While
STOP
Algorithm:
INIT
M: memory- *
IR: Instruction Register -*
IC: Instruction Counter Register -*
R:General Purpose Register -*
C:Toggle-*
Buffer-*

START EXECUTION
IC  00
EXECUTE USER PROGRAM
Algorithm:
EXECUTE USER PROGRAM (SLAVE MODE)
Loop
IR  M [IC]
IC  IC+1
Examine IR[0,1]
LR: R  M [IR[2,3]]
SR: R → M [IR[2,3]]
CR: Compare R and M [IR[2,3]]
If equal C  T else C  F
BT: If C = T then IC  IR [2,3]
GD: SI = 1
PD: SI = 2
H: SI = 3
End-Examine
End-Loop
Algorithm:
MOS (MASTER MODE)
Case SI of
1: Read
2: Write
3: Terminate
End case
Algorithm:
READ
Read next (data) card from input file in memory locations IR [2,3] through IR [2,3]
EXECUTE USER PROGRAM

WRITE
Write one block (10 words of memory) from memory locations IR [2,3] through IR [2,3] +
9 to output file
EXECUTE USER PROGRAM

TERMINATE
Write 2 blank lines in output file
LOAD

You might also like