[OSC] Problem sheet 3
1.A computer system is mainly used for non-interactive work where jobs (processes) arrive randomly, persist until completed and then leave the system. There may be many processes that need scheduling concurrently. Describe two process scheduling algorithms that would be suitable for this system and explain why they are appropriate. A different system deals mainly with multiple, concurrent, interactive processes. Give two process scheduling algorithms for this situation and explain why they are appropriate. A new system is to be developed that will run a mix of the two types of processes. Are any of the previous scheduling algorithms appropriate? Describe one new algorithm that could be used.
First, we should know what the question is really asked about?
2.What are the two advantages that threads have over multiple processes?
Kernel mode is the privileged mode to be able to access all the instruction set.
First, we should know what the question is really asked about?
- non-interactive work is like you open one process, the result is done. If you scroll the page by mouse, it is a interactive work because you make an I/O and the computer response.
- Also a non-interactive work is like CPU bounded. So what algorithms should be used for CPU bounded?
- Round Robin(remember round robin favors CPU bounded more than I/O bounded)
- And FCFS, because there will be I/O, the operation will be fast and no need to preemptive
- Shorest job first and priority queue.
- Remember priority queue can prioritise I/O bounded jobs
2.What are the two advantages that threads have over multiple processes?
- Threads incur less overhead to create/terminate/switch (address space remains the same for threads of the same process)
- When there is a blocking system call or interrupt, process are blocked but if we divide them to several threads, only one related thread will be blocked but others keep running.
- (The same to point one)Inter-thread communication is easier/faster than interprocess communication (threads share memory by default)
- Hardware! On the ppt, it says:
- Often, files are short. If the entire file fit in the same block as the inode, only one disk access would be needed to read the file, instead of two, as is presently the case. Even for longer files there would be a gain, since one fewer disk access would be needed.
Kernel mode is the privileged mode to be able to access all the instruction set.
- Interrupt cause context switch
- In the context switch, the access PCB will be in kernel mode.
What is associative memory?7.A multi-threaded CPU bound process is running on a machine with a multi-core CPU. Ignoring the overhead of context switching and thread creation, would you expect the process to finish quicker when user level threads are used, or when kernel level threads are used. Briefly explain your answer.
It is TLB!
Thus, everything is happy
- user level threads.
- Because ignoring overhead of context switching we still have syscall
评论
发表评论