]]>http://blog.nus.edu.sg/cs2106/2011/11/21/final-exam-paper-2/feed/9CS2106 in the news: OS for Cellshttp://blog.nus.edu.sg/cs2106/2011/11/21/cs2106-in-the-news-os-for-cells/
http://blog.nus.edu.sg/cs2106/2011/11/21/cs2106-in-the-news-os-for-cells/#commentsMon, 21 Nov 2011 05:34:53 +0000http://blog.nus.edu.sg/cs2106/?p=786Bid to program new life forms with ‘operating system’ for cells.http://edition.cnn.com/2011/11/18/tech/innovation/program-living-cells/index.html

“For each single application you have in mind, you have to start from scratch, and you have to start all of the design of the biological roots from scratch,” he said. “The analogy in the computer industry would be that each time you write a computer program you have to write the entire operating system.”

That’s why Krasnogor hopes his team will be able to create a line of cells running a generic “cellular operating system” that could be re-programmed with different applications.

]]>http://blog.nus.edu.sg/cs2106/2011/11/21/cs2106-in-the-news-os-for-cells/feed/2All The Besthttp://blog.nus.edu.sg/cs2106/2011/11/19/all-the-best/
http://blog.nus.edu.sg/cs2106/2011/11/19/all-the-best/#commentsFri, 18 Nov 2011 18:25:21 +0000http://blog.nus.edu.sg/cs2106/?p=784All the best for the exam. It has been fun teaching CS2106 again this semester.

(If you haven’t go to bed, consider doing so soon. You will need a fresh mind to think tomorrow.)

]]>http://blog.nus.edu.sg/cs2106/2011/11/19/all-the-best/feed/5Questions from Final Exam 2010/11http://blog.nus.edu.sg/cs2106/2011/11/18/questions-from-final-exam-201011/
http://blog.nus.edu.sg/cs2106/2011/11/18/questions-from-final-exam-201011/#commentsFri, 18 Nov 2011 09:26:08 +0000http://blog.nus.edu.sg/cs2106/?p=780The number of comments discussing the past year questions hit a record of 100 today. I thought it would be useful to summarize the confusing points from the discussion in a post here.

Q1

There is a confusion over Choice A. Microkernel fits the description of A, but we may still implement things in the user space without resorting to Microkernel architecture. One example is to schedule threads in the user space instead of kernel space (which we did not cover this semester)

Q2.

Running exec() will not change the pid of the current process. Only the core image will be replaced.

Since exec() replaces the core image of the process, any line of code after exec() will not be printed unless there is an error.

Q3

Context switch can happen when you make system calls (Lecture 2) and when page fault occurs (Lecture 9)

Q4

The confusion is on Choice D. Disk I/O takes longer time if there are multiple processes contending for the same disk. The disk scheduler would have more requests to serve, and a process disk I/O request would have to wait longer.

Q8

The confusion is basically over the meaning of “when making a function call.” The most direct interpretation (at least to me, anyway) is when we are already inside the function f. If you interpret it any other way (e.g., somewhere between the caller and the callee), then it’s ambiguous.

Q10

Kernel code and structures are normally pinned in the physical memory, since the kernel is accessed very often and to avoid irresolvable situations (imagine if the page fault handler is paged out — who will handle the page fault now?)

Q11

Two things you need to consider is: (i) how to access the end of a huge file quickly? and (ii) how to support reading a huge file backward (from end to beginning)

Q12

There is a confusion over Part (c). As discussed in tutorial, size of swap space does not affect the number of page fault.

Q15

In RR, reducing time quantum improves the response time. This question extends this principle to MLFQ — if we reduce the time quantum of low priority job, the high priority jobs will get to their turn faster as well.

]]>http://blog.nus.edu.sg/cs2106/2011/11/18/final-exam-discussion/feed/15Lab 8: Commentshttp://blog.nus.edu.sg/cs2106/2011/11/18/lab-8-comments-3/
http://blog.nus.edu.sg/cs2106/2011/11/18/lab-8-comments-3/#respondFri, 18 Nov 2011 04:51:20 +0000http://blog.nus.edu.sg/cs2106/?p=776Lab 8 has been graded. The grades and comments are available through IVLE gradebook.

As usual, please take a look and let me know if you see any unpleasant surprise.

Most of you did not setup the pipes properly. When I print out what you pipe/dup/close, things are pretty messy. Some create extra pipes, some do not close unused ends, some close everything, some dup the file descriptors in wrong order, etc.

We deduct marks according depending on how serious is your bug.

It’s very sad that despite multiple warnings, students still do not follow instructions, resulting in extra time needed to grade the labs, and delaying the release of marks for everyone. As promised in the lab sheet, 3 marks are deducted accordingly for these students *heart pain*

]]>http://blog.nus.edu.sg/cs2106/2011/11/18/lab-8-comments-3/feed/0Errata: Implementation of Soft Link using i-nodehttp://blog.nus.edu.sg/cs2106/2011/11/17/errata-implementation-of-soft-link-using-i-node/
http://blog.nus.edu.sg/cs2106/2011/11/17/errata-implementation-of-soft-link-using-i-node/#commentsWed, 16 Nov 2011 20:35:09 +0000http://blog.nus.edu.sg/cs2106/?p=774I would like to make a correction to a wrong fact I said in class.

Suppose we have a file P, which is a soft link to another file Q. During the lecture, I incorrectly said that the address inside i-node of P contains the i-node number of Q. This is WRONG. The i-node of P contains address of the data block of P on disk instead (just like normal file). To implement the link, in the data blocks on disk, we store a string that contains the path to Q.

Here is a video that re-explains this: http://goo.gl/3pbt3

What are the pros and cons of these two different approaches?

If we store the path to Q, then we need to take extra steps navigating through the file hierarchy to find the i-node of Q. Whereas if we store the i-node number of Q, we can access Q directly. On the other hand, if we store the path to Q, Q can be a file residing in a different partition.

But here is a deal breaker: what happen after Q is deleted? In both approaches, when we access P, we will encounter an error. But, if we store the i-node number of Q, this i-node number can be reused by another file!! So P can unintentionally linked to another file at a later time. This is not good.

Sorry for the confusion caused by this error.

]]>http://blog.nus.edu.sg/cs2106/2011/11/17/errata-implementation-of-soft-link-using-i-node/feed/6Lab 8: Solutionhttp://blog.nus.edu.sg/cs2106/2011/11/16/lab-8-solution/
http://blog.nus.edu.sg/cs2106/2011/11/16/lab-8-solution/#respondWed, 16 Nov 2011 04:24:52 +0000http://blog.nus.edu.sg/cs2106/?p=769We are in the middle of grading Lab 8. In the mean time, take a look at one possible solution below:

]]>http://blog.nus.edu.sg/cs2106/2011/11/16/lab-8-solution/feed/0Lab 6: Comments, Part IIhttp://blog.nus.edu.sg/cs2106/2011/11/15/lab-6-comments-part-ii/
http://blog.nus.edu.sg/cs2106/2011/11/15/lab-6-comments-part-ii/#respondMon, 14 Nov 2011 21:23:23 +0000http://blog.nus.edu.sg/cs2106/?p=767The grading for Lab 6 is done. As usual, please email me if the grade is not what you expected or you have any questions about the given remarks.

Disappointingly, many of you throw away precious points, just like that, by not following instructions on how to name files and the length of pages.

Many of you also did not explain the graphs, but merely describe what the graph looks like in words. Describing pictures is easy — given the graphs, anyone can describe what it looks like without know what is RR or MLFQ. The lab question specifically ask you to explain (i) and (ii). If you describe the graphs rather than explaining them, you would loose two points.

Here are the key points to mention:

Turnaround/waiting time increases as number of CPU bound jobs increases. WHY: CPU bound jobs spend more time computing than blocking for I/O — so CPU is kept busy, queues are longer, jobs take longer time to complete.

Response time increases slowly as number of CPU bound jobs increases. WHY: response time matters more for I/O jobs — so increasing the number of CPU jobs has little effect.

The increment is more for RR than MLFQ. WHY: there is no differentiation between I/O-bound jobs and CPU-bound jobs in RR. So I/O bound job would have to wait behind more CPU-bound jobs if percentage of CPU-bound job increases. MLFQ gives priority to I/O bound jobs, which tends to stay at high priority while CPU-bound jobs get lower priority. More CPU-bound jobs do not have significant effect on the I/O-bound jobs.

MLFQ has smaller turnaround/waiting time than RR. WHY: MLFQ approximates the behavior of shortest job first, so short jobs finish faster — leading to smaller turnaround/waiting time.

MLFQ and RR have almost the same turnaround/waiting time at 10% and 90%. WHY: When most jobs are I/O-bound or CPU-bound, the jobs fall into the same queue in MLFQ.

MLFQ has much lower response time than RR. WHY: MLFQ gives priority to I/O jobs.