12 August, 2011
During this lecture, we will first go through some admin matters and answer the question: why should you learn OS? We will then briefly discuss what is an OS and its dual role as a programming interface and resource manager. Students will learn about the concepts of system calls, user mode/kernel mode, multi-programming, and time-sharing.
Download Slides: PDF
Reading:
- Section 1.1: Introduces what is an OS.
- Section 1.2, 1.3: History and Taxonomy of OS (FYI only).
- Section 1.4: Review of CS2100 (good to read to refresh your memory).
- Section 1.6 (till 1.6.1): How a system call is invoked — no details for now.
Related Wikipedia entries are listed below. These are for students who are keen to go beyond what is covered in CS2106. Read the articles with a critical mind since Wikipedia is editable by anyone.
Hi,
I was reading Section 1.6.1 and I saw Figure 1-18.
The figure says that it lists some of the major POSIX system calls. However, many of the calls are the same as you would make when writing a C program (eg., read(fd, buffer, nbytes)). Therefore, I was wondering if the figure actually shows the system calls or rather the library functions which in turn make the corresponding system calls.
I tried to investigate this issue on the web and Wikipedia (http://en.wikipedia.org/wiki/System_call) says – ‘It should be noted that the terms “system call” and “syscall” are often incorrectly used to refer to the aforementioned C standard library functions, particularly those that act as a wrapper to corresponding system calls with the same name.’
Is this what is happening here?
Thanks.
Hi Shubham,
I think the author of the textbook refers to a particular system call by the name of the corresponding procedure that invokes it. It is because the book is dealing with a specific system, i.e. POSIX. In fact, before moving to the sub-section 1.6.1, the author mentions that “In the following sections, we will examine some of the most heavily used POSIX system calls, or more specifically, the library procedures that make those system calls”.
@Shubham, Duy is right. Most of the time, there is a one-to-one mapping between a POSIX library function and a system call. We will see some cases where this is not true over the semester.
i remember there is a family of function calls called exec() that uses just one system call in the backend. i think they are exec(), execv() and execvp().
is this one example of a non-one-to-one mapping of POSIX function call to system call?
Hi Jie Shun,
I think you are correct.
http://git.kernel.org/?p=linux/kernel/git/stable/linux-3.0.y.git;a=blob;f=arch/x86/kernel/syscall_table_32.S;h=fbb0a045a1a23bc9bdc2f9dd23c6c9673e2e13f7;hb=HEAD
This is from the Linux kernel source tree. It’s basically the list of supported system calls for the x86 kernel. exec is numbered 11 (it’s at line 13). On Linux, there’s the execv* and execl* which really just differ in how arguments are being passed to the exec call (char *[] vs. variadic args). The exec*p variants take into account of PATH environment variable if I’m not wrong.