status::device_busy
.
status::device_busy
status code in response to the open system call.
This policy is known as raw disk management, and is important for those application, such as data-base applications, that need to control all aspects of data movement between disk and primary store.
The terminal management policy also specifies the terminal line discipline (or just "line discipline" when the terminal part is understood), which specifies how, if at all, the operating system should interpret the characters begin read and written from the terminal on behalf of the user process. The input line discipline applies to the characters being read from the terminal, and the output line discipline applies to the characters being written to the terminal.
The input line discipline in this project is simple, line-oriented discipline.
The operating system should read and buffer characters until it encounters the
end-of-line character device::eoln_char
. The whole line, including the
end-of-line character, should be returned to the user process (subject to
user-process space constraints).
When the end-of-file character device::eof_char
appears in the byte stream
from the terminal, it should be removed from the stream and all characters
buffered should be returned to the user process. Once the end-of-file
character appears, no further bytes from the terminal should be passed along
until the terminal is closed and re-opened again.
The output line discipline is even simpler than the input line discipline: there is none. All bytes from the user process are passed along to the terminal without interpretation.
system_call::open
)device::disk
and device::terminal
. The status of the open system
call is returned in CPU register 0; the possible status codes are
After the open system call is completed, CPU register 0 contains the system call status:
status::ok | command completed successfully |
status::device_busy | requested device has already been allocated |
status::bad_device | the value d in CPU register 1 is not device::disk
or device::terminal |
If the open system call completed successfully, CPU register 1 contains a connection identifier, which must be included as an argument to other system calls related to this device. If the open system call didn't complete successfully, the contents of CPU register 1 is undefined.
system_call::close
)After the close system call is completed, CPU register 0 contains the system call status:
status::ok | command completed successfully |
status::bad_device | the connection id in CPU register 1 is not associated with any device |
If the close system command completes successfully, the connection id held by the user process becomes invalid and may not usefully be used in any other system call.
system_call::read
)After the read system call is completed, CPU register 0 contains system call status:
status::ok | command completed successfully |
status::bad_address | the Primary Store address in CPU register 2 is bad |
status::bad_count | the contents of CPU register 3 is bad |
status::bad_device | the connection id in CPU register 1 is not associated with any device |
status::bad_id | the number in register 4 is not a valid lock id |
At the end of a successful read (register 0 contains status::ok
), the
operating system will unlock the lock associated with the lock-id passed in as
an argument. If the system call fails (register 0 does not contain
status::ok
), the lock is not changed.
At the end of a successful terminal read, the word at the read-to address (the contents of register 2 at the time of the read system call) contains the number of characters read from the terminal; the characters read appear, one per word, in the subsequent words. The number of characters actually read from the terminal may be smaller (never larger) than the number of characters requested if the terminal sends an end-of-file character during the read. Once a terminal receives the eof-character, it will always read 0 characters.
system_call::write
)After the write system call is completed, CPU register 0 contains the system call status:
status::ok | command completed successfully |
status::bad_address | the Primary Store address in CPU register 2 is bad |
status::bad_count | the contents of CPU register 3 is bad |
status::bad_device | the connection id in CPU register 1 is not associated with any device |
status::bad_id | the number in register 4 is not a valid lock id |
At the end of a successful write (register 0 contains status::ok
), the
operating system will unlock the lock associated with the lock-id passed in as
an argument. If the system call fails (register 0 does not contain
status::ok
), the lock is not changed.
/export/home/class/CS-505/devices
to test the new features added to your
operating system. Because programs in the pa2 disks write to devices, the
simulator will create the result files results.dsk
and results.tty
.
pa2-diskio.dsk
$ /e*/h*/c*/*5/Linux/bin/os2 -d /e*/h*/c*/*5/devices/pa2-diskio.dsk The system is halted. Total execution time: 2019 ticks, idle time: 839 ticks (41%). $ /e*/h*/c*/*5/Linux/bin/print-disk-block results.dsk 511 Block 511 0000051100 0000051101 0000051102 0000051103 0000051104 0000051105 0000051106 0000051107 0000051108 0000051109 0000051110 0000051111 0000051112 0000051113 0000051114 0000051115 0000051116 0000051117 0000051118 0000051119 0000051120 0000051121 0000051122 0000051123 0000051124 0000051125 0000051126 0000051127 0000051128 0000051129 0000051130 0000051131 $
pa2-dio-checked.dsk
pa2-diskio.dsk
and the other checks the disk block once the
first program is done. The first process starts the second one with an exec
system call. These program check their work, so if you don't get an error
message, everything's o.k.
$ /e*/h*/c*/*5/Linux/bin/os2 -d /e*/h*/c*/*5/devices/pa2-dio-checked.dsk The system is halted. Total execution time: 3343 ticks, idle time: 1885 ticks (56%). $
pa2-dio-shared.dsk
pa2-dio-checked.dsk
and a chain of little programs that do nothing but
take up space and exec the next little program in the chain. Tests disk
sharing between the operating system and user processes. These program check
their work, so if you don't get an error message, everything worked.
$ /e*/h*/c*/*5/Linux/bin/os2 -d /e*/h*/c*/*5/devices/pa2-dio-shared.dsk The system is halted. Total execution time: 28948 ticks, idle time: 27295 ticks (94%). $
pa2-3dio.dsk
pa2-diskio.dsk
, each working on one of the last three blocks in the disk.
This disk tests disk sharing among user processes. These programs don't check
their work.
$ /e*/h*/c*/*5/Linux/bin/os2 -d /e*/h*/c*/*5/devices/pa2-3dio.dsk The system is halted. Total execution time: 5531 ticks, idle time: 1948 ticks (35%). $ /e*/h*/c*/*5/Linux/bin/print-disk-block results.dsk 509 510 511 Block 509 0000050900 0000050901 0000050902 0000050903 0000050904 0000050905 0000050906 0000050907 0000050908 0000050909 0000050910 0000050911 0000050912 0000050913 0000050914 0000050915 0000050916 0000050917 0000050918 0000050919 0000050920 0000050921 0000050922 0000050923 0000050924 0000050925 0000050926 0000050927 0000050928 0000050929 0000050930 0000050931 Block 510 0000051000 0000051001 0000051002 0000051003 0000051004 0000051005 0000051006 0000051007 0000051008 0000051009 0000051010 0000051011 0000051012 0000051013 0000051014 0000051015 0000051016 0000051017 0000051018 0000051019 0000051020 0000051021 0000051022 0000051023 0000051024 0000051025 0000051026 0000051027 0000051028 0000051029 0000051030 0000051031 Block 511 0000051100 0000051101 0000051102 0000051103 0000051104 0000051105 0000051106 0000051107 0000051108 0000051109 0000051110 0000051111 0000051112 0000051113 0000051114 0000051115 0000051116 0000051117 0000051118 0000051119 0000051120 0000051121 0000051122 0000051123 0000051124 0000051125 0000051126 0000051127 0000051128 0000051129 0000051130 0000051131 $
pa2-bad.dsk
$ /e*/h*/c*/*5/Linux/bin/os2 -d /e*/h*/c*/*5/devices/pa2-bad.dsk The system is halted. Total execution time: 420 ticks, idle time: 209 ticks (49%). $
pa2-ttycopy.dsk
, pa2-ttycopy.tty
results.tty
file identical to pa2-ttycopy.tty
.
$ /e*/h*/c*/*5/Linux/bin/os2 -d /e*/h*/c*/*5/devices/pa2-ttycopy.dsk \ -t /e*/h*/c*/*5/devices/pa2-ttycopy.tty The system is halted. Total execution time: 3060 ticks, idle time: 69 ticks (2%). $ diff /e*/h*/c*/*5/devices/pa2-ttycopy.tty results.tty $
If you're looking for a way to proceed, you might want to consider the following steps:
This page last modified on 9 December 2002.