1.2
the current date.
(or prints) Result is -1
1.3
0x02220008
(Page directory)2 (Frame 2)3
1.4
maximum 100cylinker * 5ms + 10ms + 2K / (10sector * 1K / 10ms) = 512ms
average 1/3 * 100 * 5ms + 1/2 * 10ms + 2 / (10 * 1 / 10) = 173.67ms
1.5
use shortest job first.
the sequence of execution is c,a,d,b
average turnaround time is (3+7+16+28)/4 = 13.5s
1.6
the system seems responds more quickly.
more time are wasted to context switch.
lower effetive rate of CPU speed
1.7
4 4 2 3 4
3 4 2 3
2 4 2 3
1 1 2 3 5
1 1 2 3
0 1 2 0 6
0 1 2 0
1 1 2 0
2 1 2 0
4 1 2 4 7
1.8
each frame size 4K
each page table entry size 4Bytes
1MB requires 1 page directory entry and 1MB/4KB = 2^8 page table entries,
that it is, one page directory and one page table.
100 processes require one page directory and 100 page tables.
the total memory needed for the page tables is 101*4KB = 404KB
if each process has another 1MB, then the memory required is 404KB
1.9
if granularity bit is set to 0, the granularity of the limit value is
Byte. The limit is as describe in limit field of GDT/LDT in the unit of
Byte. If granularity bit is set to 1, the granularity of the limit value
is 4K. The limit is 4K times the number in the field of GDT/LDT in the
unit of Byte.
1.10
expected 0.99 * 5ns + 0.01 * 0.9999 * (50 + 5)ns + 0.01 * 0.0001 *
(50ns+5ns+5ms)
maximum 50ns + 5ns + 5ms
2.1
processes a and b are created.
the output of a is piped to the input of b and the output of b is
indirected to file c
the interprete first creat a pipe between a and b.
the it fork a new process and redirect the STDOUT of the new process to
one end of the pipe and execute a by calling execlp("a","a",NULL) (or
something else similar). In the meantime, the original process redirects
its STDIN to the other end of pipe and creates another new process by
calling fork. The new child process redirects its STDOUT to file c and
executed program b.
2.2
Apache
while (TRUE) {
socket = accept(...);
if (OK) {
if (fork()==0) {
process(socket);
close(cocket);
}
}
}
3.1
credit -> available resource
customer -> process
agreement -> the system allocat some resources to a process.
loan -> resource that owned by the process
borrowing -> requesting for new resource
limit -> enough resources that is kept to fully supply any process.
repayment -> deallocating resource.
......................................................................
......................................................................
3.2
1 decreaseing mutex to avoid two processes entering CS
simultaneously, or put the process to sleep if one process is in its CS
2 indicates the current philosopher is thinking. That it is, it
releases the resources which may be required by other processes.
3 4 test whether the current philosopher's neighbors are hungry
(requiring resources). If so, it sets that the processes can possess the
resource and wake them up if they sleep.
5 leaving CS.
对书中P60的代码不是很熟悉它具体是怎么运行的.其他人知道的请说一下.
4.1
for segmentation
the OS allocats GDT/LDT for each process when the process is first
executed (when the CPU works in protected mode). In context switch, the
os loads the corresponding GDT/LDT into the memory of the process if
it's not in the memory, and puts the GDT/LDT address in GDTR or LDTR
registers.
The OS also responds to some interrupts such as the offset beyond the
limit, the segment not present and so on.
the OS deallocates the GDT/LDT when the process terminates
the paging
the OS must allocate page tables for processes and add new entries into
page tables for each process before they execute.
The OS evicts page from second storage if the page is not in memory, and
choose one frame to swapped to the second storage to make room for the
needed page.
The OS must remove page entries if the process terminates.
4.2
advantage of having virtual address space larger than physical address
space: the process needing more memory than physical memory can run.
the disadvantage: the whole image of the process can't be loaded into
the memory and page faults happen frequently to slows down the execution.
advantage of having virtual address space smaller than physical address
space: The whole image of the process can be loaded into the memory and
thus reduce page faults.
disvantage: it confines the size of the process to the size smaller than
physical memory.
4.3
LRU, NFU, clock ????
prefetch
5.1
disk arm schuduling,cache and organization of disk to improve speed.
RAID to improve both speed and safety
5.2
1 efficience.
for the small size files, all the block numbers can be read from memory
after the inode structrue is loaded into the memory, reducing the time
because disk reading is no necessary.
2 size of the file
because i_block[] has one-layer, tow-layer, three-layer indircetion
structures for accessing the data blocks. Thus it makes it possible that
the file can be very large and i_block[] can still point out where the
blocks are via indirection structures
3 random access to file.
since all the block number are directly or indirectly indicated by
i_block[], it is fast to locate a certain block when the file is random
accessed.
limitation
the structure may take up much space in small partition.
6.1
--
Computer Science and Engineering Department
Information Technology School
Fudan University, 200433
ShangHai
China.P.R
guozhang wang 写道:
> 1.4 maximum: 先从1到100,为 99cylinker * 5ms,然后rotation latency
> 10ms, 读10/10 = 1ms, 然后再从100到101,rotation latency 10ms, 然后读
> 1ms : = 517ms
> 个人意见
>
> 2006/11/23, Huang Maoliang <kc...@163.com <mailto:kc...@163.com>>:
ShangHai
China.P.R
为什么这么写?socket是什么意思?
ShangHai
China.P.R
Backup and duplicate saves disk went disk corrupt
可能下面的会更好
int num_child_process = 0;
while (TRUE) {
socket = accept(...);
if (OK) {
num_child_process++;
if (fork()==0) {
process(socket);
close(socket);
}
}
}
while(num_child_process--) { // wait until all child processes terminate.
wait();
}
guozhang wang 写道:
> 2.2
> Apache
>
> 为什么这么写?socket是什么意思?
>
>
>
> 在06-11-23,*Huang Maoliang* <kc...@163.com <mailto:kc...@163.com>> 写
> 道:
>
>
>
> guozhang wang 写道:
> > the total memory needed for the page tables is 200 * 1KB = 404KB
> 一个process就有一个page directory哦.好像是这样的.
> >
> > 在06-11-23,*guozhang wang* <huzi...@gmail.com
> <mailto:huzi...@gmail.com>
> > <mailto:huzi...@gmail.com <mailto:huzi...@gmail.com>>> 写道:
> >
> > 100 processes require 100 page directories and 100 page tables.
> >
> > 在06-11-23,*guozhang wang* <huzi...@gmail.com
> <mailto:huzi...@gmail.com>
> > <mailto: huzi...@gmail.com <mailto:huzi...@gmail.com>> > 写道:
> >
> > 当seek time < rotation time 在 ajancent cylin上就只计算
> > rotation time
> >
> 但是worse time也可以这么认为,当arm head移到下一个cylinder时,不巧那个
> sector刚转过,这样不是还要等一个rotation time吗?
> >
> >
> > 在06-11-23,*Huang Maoliang* <kc...@163.com <mailto:kc...@163.com>
> > <mailto:kc...@163.com <mailto:kc...@163.com>>> 写道:
> >
> >
> > 如果那两个sector是在两个cylinder上的话,还要一个seek time,
> > 和rotation time
> > 和read time.那是522ms啦.
> >
> >
> > guozhang wang 写道:
> > > 1.4 maximum: 先从1到100,为 99cylinker * 5ms,然后
> > rotation latency
> > > 10ms, 读10/10 = 1ms, 然后再从100到101,rotation latency
> > 10ms, 然后读
> > > 1ms : = 517ms
> > > 个人意见
> > >
> > > 2006/11/23, Huang Maoliang < kc...@163.com <mailto:kc...@163.com>
> > <mailto:kc...@163.com <mailto:kc...@163.com>>
> <mailto:kc...@163.com <mailto:kc...@163.com>
> > <mailto: kc...@163.com <mailto:kc...@163.com>>>>:
guozhang wang 写道:
> 5.1
> limitation
> the structure may take up much space in small partition.
> 看不懂,说的什么意思?
> 在06-11-23,*guozhang wang* <huzi...@gmail.com
> <mailto:huzi...@gmail.com>> 写道:
>
> disk arm scheduling, cache and organization of disk to improve speed.
> RAID to improve both speed and safety
>
> Backup and duplicate saves disk went disk corrupt
>
>
>
> 在06-11-23,*guozhang wang* <huzi...@gmail.com
> <mailto:huzi...@gmail.com> > 写道:
>
> 这道题是2.3吧,2.2你知道怎么做么?
>
>
> 在06-11-23,*guozhang wang* <huzi...@gmail.com
> <mailto:huzi...@gmail.com> > 写道:
>
> 2.2
> Apache
>
> while (TRUE) {
> socket = accept(...);
> if (OK) {
> if (fork()==0) {
> process(socket);
> close(socket);
> }
> }
> }
>
> 为什么这么写?socket是什么意思?
>
>
>
> 在06-11-23,*Huang Maoliang* <kc...@163.com
> <mailto:kc...@163.com>> 写道:
>
>
>
> guozhang wang 写道:
> > the total memory needed for the page tables is 200 *
> 1KB = 404KB
> 一个process就有一个page directory哦.好像是这样的.
> >
> > 在06-11-23,*guozhang wang* <huzi...@gmail.com
> <mailto:huzi...@gmail.com>
> > <mailto: huzi...@gmail.com
> <mailto:huzi...@gmail.com>>> 写道:
> >
> > 100 processes require 100 page directories and 100
> page tables.
> >
> > 在06-11-23,*guozhang wang* < huzi...@gmail.com
> <mailto:huzi...@gmail.com>
> > <mailto: huzi...@gmail.com
> <mailto:huzi...@gmail.com>> > 写道:
> >
> > 当seek time < rotation time 在 ajancent cylin上就只计算
> > rotation time
> >
> 但是worse time也可以这么认为,当arm head移到下一个
> cylinder时,不巧那个
> sector刚转过,这样不是还要等一个rotation time吗?
> >
> >
> > 在06-11-23,*Huang Maoliang* < kc...@163.com
> <mailto:kc...@163.com>
> > <mailto:kc...@163.com <mailto:kc...@163.com>>> 写道:
> >
> >
> > 如果那两个sector是在两个cylinder上的话,还要一个seek
> time,
> > 和rotation time
> > 和read time.那是522ms啦.
> >
> >
> > guozhang wang 写道:
> > > 1.4 maximum: 先从1到100,为 99cylinker * 5ms,然后
> > rotation latency
> > > 10ms, 读10/10 = 1ms, 然后再从100到101,rotation latency
> > 10ms, 然后读
> > > 1ms : = 517ms
> > > 个人意见
> > >
> > > 2006/11/23, Huang Maoliang < kc...@163.com
> <mailto:kc...@163.com>
> > <mailto: kc...@163.com <mailto:kc...@163.com>>
> <mailto:kc...@163.com <mailto:kc...@163.com>
> > <mailto: kc...@163.com <mailto:kc...@163.com>>>>: