Sunday, 23 January 2011
Sunday, 16 January 2011
CS401 Assignment#04 Sol
Modify multitasking and dynamic thread registration example (11.2) such that • It displays a rotating bar on top left corner of the screen (as in Example 11.1). • Also, if we press “S (both small and caps)”, it will generate new process which will display rotating bars on screen in next column from the previous one. • And if “Q (both small and caps)” is pressed from keyboard it will restore every thing to normal as it was before the multitasking kernel was there. You can generate maximum up to 20 processes. After 20 processes no new process will be created if “S (both small and caps)” will be pressed from keyboard
Solution:
[org 0x0100]
jmp start
; Original Registers:
;ax, bx, cx, dx, si, di, bp, sp, ip, cs, ds, ss, es, flags
; 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26
; PCB layout:
;ax, bx, cx, dx, si, di, bp, sp, ip, cs, ds, ss, es, flags, next, dummy
; 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26 , 28 , 30
originalstate: times 14 dw 0
oldtimer: dd 0
pcb: times 20*16 dw 0 ; space for 20 PCBs
stack: times 20*256 dw 0 ; space for 20 512 byte stacks
nextpcb: dw 1 ; index of next free pcb
current: dw 0 ; index of current pcb
Solution:
[org 0x0100]
jmp start
; Original Registers:
;ax, bx, cx, dx, si, di, bp, sp, ip, cs, ds, ss, es, flags
; 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26
; PCB layout:
;ax, bx, cx, dx, si, di, bp, sp, ip, cs, ds, ss, es, flags, next, dummy
; 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26 , 28 , 30
originalstate: times 14 dw 0
oldtimer: dd 0
pcb: times 20*16 dw 0 ; space for 20 PCBs
stack: times 20*256 dw 0 ; space for 20 512 byte stacks
nextpcb: dw 1 ; index of next free pcb
current: dw 0 ; index of current pcb