<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://homeostasis.scs.carleton.ca/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sblais2</id>
	<title>Soma-notes - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://homeostasis.scs.carleton.ca/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sblais2"/>
	<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php/Special:Contributions/Sblais2"/>
	<updated>2026-06-03T02:14:50Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=Talk:COMP_3000_Essay_2_2010_Question_11&amp;diff=5948</id>
		<title>Talk:COMP 3000 Essay 2 2010 Question 11</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=Talk:COMP_3000_Essay_2_2010_Question_11&amp;diff=5948"/>
		<updated>2010-12-01T17:50:30Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;--[[User:Sblais2|Sblais2]] 17:50, 1 December 2010 (UTC) I added stuf into the Research problems. I think I summarized most of them. If I forgot any, please add them in. I also added the missing references in the reference section. For Fedor, we seem to miss some content in 2 sections. Also, you could read through the other section and add/change some pertinent information that might&#039;ve been missed that would make this essay even better.&lt;br /&gt;
&lt;br /&gt;
--[[User:Sblais2|Sblais2]] 15:11, 1 December 2010 (UTC) Would it be possible to add your references at the bottom please? Even if it is a link. I have added the article link at the top of the essay.&lt;br /&gt;
&lt;br /&gt;
Hey guys, sorry its taken me a while to post here. If there is a particular topic that needs researching, I could spend some hours doing that tomorrow - suggestions? Also, I intend to fix up the style&amp;amp;structure after everything is done as I am quite good with that. &lt;br /&gt;
&lt;br /&gt;
Fedor&lt;br /&gt;
&lt;br /&gt;
--[[User:ScottG|ScottG]] 21:36, 26 November 2010 (UTC) So I was a little (more than a little) behind on my initially estimated time for getting stuff up on Guest Timekeeping, but that&#039;s the gist of it there now. I&#039;m going to try to buff it up a bit before it&#039;s due, since what I put in is a bit rougher than I&#039;d like. If I seem to be missing something that should be pretty obvious, let me know and I&#039;ll work it in.&lt;br /&gt;
&lt;br /&gt;
--[[User:Jjpwilso|Jjpwilso]] 15:49, 23 November 2010 (UTC) I&#039;ve been completely swamped with COMP3004 stuff (among other things) and feeling guilty as hell about this essay. The good news, for those who might have missed today&#039;s lecture, is we have an extension of one week. Phew!!&lt;br /&gt;
&lt;br /&gt;
--[[User:Sblais2|Sblais2]] 21:29, 22 November 2010 (UTC) I have added a small part to the background section. I have created by hand a diagram explaining how it works. I tried to find an original way of doing it but it is the same diagram everywhere. Please feel free to comment here or by sending me an email.&lt;br /&gt;
&lt;br /&gt;
--[[User:AbsMechanik|AbsMechanik]] 19:46, 22 November 2010 (UTC) Here&#039;s what my research has led me to so far. I&#039;m trying to come up with good points for the research problem, contribution and critique part of this essay. Here&#039;s a bunch of links, I&#039;ve come across. I think there will be a few more tonight. Feel free to read through &#039;em: &lt;br /&gt;
&amp;lt;br&amp;gt;http://www.vmware.com/files/pdf/Timekeeping-In-VirtualMachines.pdf&lt;br /&gt;
&amp;lt;br&amp;gt;http://www.xen.org/files/xen_interface.pdf&lt;br /&gt;
&amp;lt;br&amp;gt;http://www.microsoft.com/whdc/system/sysinternals/mm-timer.mspx&lt;br /&gt;
&amp;lt;br&amp;gt;http://www.intel.com/hardwaredesign/hpetspec_1.pdf&lt;br /&gt;
&amp;lt;br&amp;gt;http://www.cubinlab.ee.unimelb.edu.au/radclock/&lt;br /&gt;
&lt;br /&gt;
--[[User:ScottG|ScottG]] 18:55, 22 November 2010 (UTC) I&#039;m good taking the Guest Timekeeping section. Hopefully I&#039;ll have some stuff up tonight or early tomorrow for it.&lt;br /&gt;
&lt;br /&gt;
--[[User:Sblais2|Sblais2]] 17:14, 22 November 2010 (UTC) I will be working on the Background section. I will dedicate it to explain some of the key concepts that are used in the research paper that will allow the readers to have a better understanding on the rest of our essay. The structure you&#039;ve put in place looks good but it might get modified, depending on the text will flow. The diagram is a good idea. I will drawn a simple one and add it in. Feel free again to critique.&lt;br /&gt;
&lt;br /&gt;
--[[User:Jjpwilso|Jjpwilso]] 15:12, 16 November 2010 (UTC) I wanted to get a structure started, so I have stubbed out the first section. Note: some of the sub-sections might belong in the Research Problem section but we can easily move them if they fit there. Let&#039;s use this area to plan who is doing what. Feel free to critique any of my submissions. When you comment here, please put your comments at the very top so we can easily see recent posts.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Participants=&lt;br /&gt;
(X) Blais   Sylvain sblais2 - Email: syl20blais@gmail.com&amp;lt;br&amp;gt;&lt;br /&gt;
(X) Graham  Scott   sgraham6&amp;lt;br&amp;gt;&lt;br /&gt;
(X) Ilitchev Fedor  filitche fedor dot ilitchev at gmail dot com &amp;lt;br&amp;gt; &lt;br /&gt;
(X) Panke   Shane   spanke&amp;lt;br&amp;gt;&lt;br /&gt;
(X) Shukla  Abhinav ashukla2&amp;lt;br&amp;gt;&lt;br /&gt;
(X) Wilson  Robert  jjpwilso&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_2_2010_Question_11&amp;diff=5946</id>
		<title>COMP 3000 Essay 2 2010 Question 11</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_2_2010_Question_11&amp;diff=5946"/>
		<updated>2010-12-01T17:46:19Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Virtualize Everything But Time =&lt;br /&gt;
Article written by Timothy Broomhead, Laurence Cremean, Julien Ridoux and Darrel Veitch. They are working for the Center for Ultra-Broadband Information Networks (CUBIN) Department of Electrical &amp;amp; Electronic Engineering at the University of Melbourne in Australia. Here is the link to the article: [http://www.usenix.org/events/osdi10/tech/full_papers/Broomhead.pdf]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Background Concepts=&lt;br /&gt;
&lt;br /&gt;
To better understand this paper, it is very important to have a good understanding of the general concepts breached in it. For example, we all know what clocks are in our day-to-day life but what are they in the context of computing? In this section, we will describe concepts like timekeeping, hardware/software clocks, the advantages and disadvantages of the different available counters, synchronization algorithms and explains what is a para-virtualized system.&lt;br /&gt;
&lt;br /&gt;
===Timekeeping===&lt;br /&gt;
&lt;br /&gt;
Since thousands of years, men have tried to find better ways to keep track of time. From sundials to atomic clocks, they were all made for the specific purpose of measuring the passage of time. This is not so different in computer operating systems. It is typically done in one of two ways: tick counting and tickless timekeeping[http://www.vmware.com/files/pdf/Timekeeping-In-VirtualMachines.pdf]. Tick counting is when the operating system sets up an hardware device, generally a CPU, to interrupt at a certain rate. So each time one of those interrupts are called(a tick), the operating system will keep track of it in a counter. That will tell the system how much time has passed. In tickless timekeeping, instead of the OS keeping track of time through interrupts, a hardware device is used instead starting its own counter when the system is booted. The OS just need to read the counter from it when needed. Tickless timekeeping seems to be the better way to keep track of time because it doesn’t hog the CPU with hardware interrupts however, its performance is very dependent on the type of hardware used. Another disadvantages is that they tend to drift and can cause inaccuracy. I will explains those drifts later. But both of these are just counters. They don’t know what is the actual real-time. To remedy that, either a computer gets its time from a battery-backed real-time clock or it queries a network time server(NTP) to get the current time. The computer can also use software in the form of a daemon that will run periodically to make adjustments to the time.&lt;br /&gt;
&lt;br /&gt;
===Clocks===&lt;br /&gt;
&lt;br /&gt;
Computer “clocks” or “timers” can be hardware based, software based or they can even be an hybrid. The most commonly found timer is the hardware timer. All of the hardware timers can be generally described by this diagram where some have either more or less features:&lt;br /&gt;
&lt;br /&gt;
Diagram1. Timer Abstraction&lt;br /&gt;
&lt;br /&gt;
[[File:Timerabstract.jpg]]&lt;br /&gt;
&lt;br /&gt;
This diagram nicely represent how tick counting works. The oscillator runs at a predetermine frequency. The operating system might have to mesure it when the system boots. The counter starts with a predetermined value which can be set by software. For every cycle of the oscillator, the counter counts down one unit. When it reaches zero, its generates an output signal that might interrupt the CPU. That same interrupt will then allow the counter’s initial value to be reloaded into the counter and the process begins again. As I said earlier, not all hardware timer works exactly like that. Some actually counts up, doesn&#039;t use interrupts or doesn&#039;t have an initial counter value but they still follow the same principle.&lt;br /&gt;
&lt;br /&gt;
===Timers===&lt;br /&gt;
# PIT is useful for generating interrupts at regular intervals through its three channels. Channel 0 is bound to IRQ0 which interrupts the CPU at regular intervals. Channel 1 is specific to each system and Channel 2 is connected to the speaker system. As such, we only need to concern ourselves with Channel 0. [http://www.osdever.net/bkerndev/Docs/pit.htm]&lt;br /&gt;
# CMOS RTC, also known as a CMOS battery, allows the CMOS chip to remain powered to keep track of things like time even while the physical PC unit has no source of power. If there is no CMOS battery on the motherboard, the computer would reset to its default time each restart. The battery itself can die, as expected, if the computer is powered off and not used for a long period of time. This can cause issues with the main OS as well as the VM. [http://kb.iu.edu/data/adoy.html]&lt;br /&gt;
# Local APIC handles all external interrupts for the processor in the system. It can also accept and generate inter-processor interrupts between Local APICs. [http://developer.intel.com/design/pentium/datashts/24201606.pdf]&lt;br /&gt;
# ACPI (I will fill these in later, Nov. 29th Update) --[[User:Spanke|Spanke]]&lt;br /&gt;
# TSC&lt;br /&gt;
# HPET&lt;br /&gt;
&lt;br /&gt;
==Guest Timekeeping==&lt;br /&gt;
&lt;br /&gt;
Guest timekeeping is done using the same general methods as any computer timekeeping, using either tick counting or tickless systems. Where the two begin to differ, however, is that a host operating system is able to communicate directly with the physical hardware, while the guest operating system is unable to do so, having to communicate with the host system that it wants to communicate with the hardware. Having to do this is the greatest source of the guest operating system&#039;s clock losing accuracy, or more simply called drifting.&lt;br /&gt;
&lt;br /&gt;
===Sources of Drift===&lt;br /&gt;
&lt;br /&gt;
When a guest operating system is started, its clock simply synchronizes with the host&#039;s – some virtual machines such as VMware also do this when it is resumed from a suspended state, or restored from a snapshot – so it is easy to think that, since it starts off correctly the guest&#039;s clock will continue to be correct. That is, of course, incorrect. The first source of drift is simply due to the drift a host incurs in its own timekeeping. A clock is almost never entirely accurate, having a slight error due to the time used to communicate with the counter, even on the host system, and because the guest communicates with the host in order to keep track of its time, an error in the host&#039;s time is not only passed on to the guest, but because the host is trying to correct its own time the guest&#039;s request for a count is given slightly less priority, making it yet again lose accuracy. The larger the drift in the host, the larger the drift in the guest, as the host&#039;s drift simply compounds the issue.&lt;br /&gt;
&lt;br /&gt;
Aside from the host&#039;s own drift, the other cause of drift in the virtual environment is the fact that the it is treated like a process by the host. In and of itself this doesn&#039;t seem like a problem, but because of it it can be denied the CPU time required, or allocated less memory than needed. With restricted CPU time, it&#039;s easy for the requested ticks or requested read of a counter to pile up and create a backlog of requests, or simply receive the requested data late enough to throw its clock off. With memory, if the virtual environment does not have enough allocated to it by the host it can run into the problem of swapping out pages that are needed soon. Swapping the pages back in will momentarily bring the entire virtual environment to a halt, so ticks are missed and the clock falls behind.&lt;br /&gt;
&lt;br /&gt;
===Impact of Drift===&lt;br /&gt;
&lt;br /&gt;
The impact of drift essentially boils down to round-off errors and lost ticks. The practical impact of drift, however, is quite apparent in any automated system. For a relatable real-world example, though not in a virtual environment, in a factory&#039;s assembly line, the machinery is finely tuned to do its own specific part at certain intervals, and it generally does so with impressive efficiency. If the clock in the system were to drift, however, a specific machine may move too soon or too late, bringing the line to a potentially catastrophic halt. In a virtual environment, drift is a bit more subtle, as one result of it could be skewed process scheduling – some schedulers give a certain amount of time to a process before moving on, but if the guest&#039;s time has drifted substantially, when it tries to correct its time it could give more or less time to the processes in the scheduler.&lt;br /&gt;
&lt;br /&gt;
===Compensation Strategies===&lt;br /&gt;
&lt;br /&gt;
There are a number of compensation strategies for dealing with drift, depending on the cause of it. If the problem is due to CPU management issues, then the host can give more CPU time to the virtual machine, or it can lower the timer interrupt rate – or simply use a tickless counter. If it is due to a  memory management issue, allocating more memory to the virtual environment should prevent the system from needing to swap out page files so often.&lt;br /&gt;
&lt;br /&gt;
If the issue is from neither of those, but simply due to the inevitable lag when the guest communicates with the hardware via the host, then there are other methods to correct the drift. Most systems natively have algorithms built in to correct the time if it gets too far ahead or behind real time, though they are not without their own faults; if the time is set ahead when catching up, the backlog of ticks it has built up may not be cleared, so it could potentially set itself ahead multiple times until the backlog is dealt with. Tools built into the virtual machine itself can also deal with drift to an extent, as VMware Tools does. This kind of tool checks to see if the clock&#039;s error is within a certain margin. If it exceeds the margin, then the backlog is set to zero – to prevent the issue mentioned with the native algorithms – and resynchronizes with the host clock before the guest goes back to keeping track of time as it normally would.&lt;br /&gt;
&lt;br /&gt;
=Research problem=&lt;br /&gt;
&lt;br /&gt;
Today, the use of the Network Time Protocol and of daemons like ntpd is the dominant solution for accurate timekeeping. In optimal conditions, the ntpd can be very good but these situations rarely happen. Network congestion, disconnections, lower quality networking hardware and unsuspected system events can create offsets errors in the order of 10‘s or even 100 milliseconds(ms). [http://www.cubinlab.ee.unimelb.edu.au/~darryl/Publications/tscclock_final.pdf]&lt;br /&gt;
For demanding applications, this is neither robust or reliable. One way to enhance the performance of ntpd would be to poll from the NTP server more often as this would reduced the offset error but unfortunately, this would increase the network traffic which could cause network congestions which would raise the offset error. So this won’t work. &lt;br /&gt;
&lt;br /&gt;
Another problem with current system software clocks using NTP(like ntpd), is that they provide only an absolute clock.[http://www.cubinlab.ee.unimelb.edu.au/~darryl/Publications/synch_ToN.pdf]&lt;br /&gt;
So for applications that deals with network managements and measurements, this is unsuitable. Why? Because NTP focus on offset and not on hardware clock oscillator rate. For example, when calculating delay variations, the offset error doesn’t change anything to the calculations but the clocks’ oscillator rate variation does affect it. So having a more accurate timestamp would make those calculation more precise. Which mean we would need another system software clock.&lt;br /&gt;
&lt;br /&gt;
In virtualization(in this case Xen), when migrating a running system from one system to another can cause issues and this is again caused by the ntpd daemon. By default, each guest OS runs its own instance of the ntpd daemon. So the synchronization algorithm keeps track of the reference wallclock time, rate-of-drift and current clock error, which are defined by the hardware clock on the system. So when migrating the virtualized OS to another system, the ntpd state is saved and when it is enabled again on the new system, thats where the problems starts. Because no two hardware clocks drifts the same way or have the exact same wallclock time, all the information traced by the daemon are all of a sudden inaccurate. This could prove disastrous to the system. This could go from a slowly recoverable error to one where ntpd might never recover, making the virtualized OS unstable.&lt;br /&gt;
&lt;br /&gt;
=Contribution=&lt;br /&gt;
=Critique=&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. &amp;quot;Virtualize Everything But Time&amp;quot; by Timothy Broomhead, Laurence Cremean, Julien Ridoux and Darrel Veitch, 2010. http://www.usenix.org/events/osdi10/tech/full_papers/Broomhead.pdf&lt;br /&gt;
&lt;br /&gt;
2. &amp;quot;Timekeeping in Virtual Machines, Information Guide&amp;quot; from VMWare. http://www.vmware.com/files/pdf/Timekeeping-In-VirtualMachines.pdf&lt;br /&gt;
&lt;br /&gt;
3. &amp;quot;Bran&#039;s Kernel Development Tutorial&amp;quot; from Bona Fide OS Developer website. http://www.osdever.net/bkerndev/Docs/pit.htm  &lt;br /&gt;
&lt;br /&gt;
4. &amp;quot;What is a CMOS battery, and why does my computer need one?&amp;quot; from the Indiana University&#039;s Knowledge Base, 2010. http://kb.iu.edu/data/adoy.html&lt;br /&gt;
&lt;br /&gt;
5. &amp;quot;Multiprocessor Specification version 1.4&amp;quot; from Intel, 1997. http://developer.intel.com/design/pentium/datashts/24201606.pdf&lt;br /&gt;
&lt;br /&gt;
6. &amp;quot;PC Based Precision Timing Without GPS&amp;quot; by Attila Pa ́sztor and Darryl Veitch, 2002. http://www.cubinlab.ee.unimelb.edu.au/~darryl/Publications/tscclock_final.pdf&lt;br /&gt;
&lt;br /&gt;
7. &amp;quot;Robust Synchronization of Absolute and Difference Clocks over Networks&amp;quot; by Darryl Veitch, Julien Ridoux and Satish Babu Korada, 2009. http://www.cubinlab.ee.unimelb.edu.au/~darryl/Publications/synch_ToN.pdf&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_2_2010_Question_11&amp;diff=5945</id>
		<title>COMP 3000 Essay 2 2010 Question 11</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_2_2010_Question_11&amp;diff=5945"/>
		<updated>2010-12-01T17:45:55Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Virtualize Everything But Time =&lt;br /&gt;
Article written by Timothy Broomhead, Laurence Cremean, Julien Ridoux and Darrel Veitch. They are working for the Center for Ultra-Broadband Information Networks (CUBIN) Department of Electrical &amp;amp; Electronic Engineering at the University of Melbourne in Australia. Here is the link to the article: [http://www.usenix.org/events/osdi10/tech/full_papers/Broomhead.pdf]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Background Concepts=&lt;br /&gt;
&lt;br /&gt;
To better understand this paper, it is very important to have a good understanding of the general concepts breached in it. For example, we all know what clocks are in our day-to-day life but what are they in the context of computing? In this section, we will describe concepts like timekeeping, hardware/software clocks, the advantages and disadvantages of the different available counters, synchronization algorithms and explains what is a para-virtualized system.&lt;br /&gt;
&lt;br /&gt;
===Timekeeping===&lt;br /&gt;
&lt;br /&gt;
Since thousands of years, men have tried to find better ways to keep track of time. From sundials to atomic clocks, they were all made for the specific purpose of measuring the passage of time. This is not so different in computer operating systems. It is typically done in one of two ways: tick counting and tickless timekeeping[http://www.vmware.com/files/pdf/Timekeeping-In-VirtualMachines.pdf]. Tick counting is when the operating system sets up an hardware device, generally a CPU, to interrupt at a certain rate. So each time one of those interrupts are called(a tick), the operating system will keep track of it in a counter. That will tell the system how much time has passed. In tickless timekeeping, instead of the OS keeping track of time through interrupts, a hardware device is used instead starting its own counter when the system is booted. The OS just need to read the counter from it when needed. Tickless timekeeping seems to be the better way to keep track of time because it doesn’t hog the CPU with hardware interrupts however, its performance is very dependent on the type of hardware used. Another disadvantages is that they tend to drift and can cause inaccuracy. I will explains those drifts later. But both of these are just counters. They don’t know what is the actual real-time. To remedy that, either a computer gets its time from a battery-backed real-time clock or it queries a network time server(NTP) to get the current time. The computer can also use software in the form of a daemon that will run periodically to make adjustments to the time.&lt;br /&gt;
&lt;br /&gt;
===Clocks===&lt;br /&gt;
&lt;br /&gt;
Computer “clocks” or “timers” can be hardware based, software based or they can even be an hybrid. The most commonly found timer is the hardware timer. All of the hardware timers can be generally described by this diagram where some have either more or less features:&lt;br /&gt;
&lt;br /&gt;
Diagram1. Timer Abstraction&lt;br /&gt;
&lt;br /&gt;
[[File:Timerabstract.jpg]]&lt;br /&gt;
&lt;br /&gt;
This diagram nicely represent how tick counting works. The oscillator runs at a predetermine frequency. The operating system might have to mesure it when the system boots. The counter starts with a predetermined value which can be set by software. For every cycle of the oscillator, the counter counts down one unit. When it reaches zero, its generates an output signal that might interrupt the CPU. That same interrupt will then allow the counter’s initial value to be reloaded into the counter and the process begins again. As I said earlier, not all hardware timer works exactly like that. Some actually counts up, doesn&#039;t use interrupts or doesn&#039;t have an initial counter value but they still follow the same principle.&lt;br /&gt;
&lt;br /&gt;
===Timers===&lt;br /&gt;
# PIT is useful for generating interrupts at regular intervals through its three channels. Channel 0 is bound to IRQ0 which interrupts the CPU at regular intervals. Channel 1 is specific to each system and Channel 2 is connected to the speaker system. As such, we only need to concern ourselves with Channel 0. [http://www.osdever.net/bkerndev/Docs/pit.htm]&lt;br /&gt;
# CMOS RTC, also known as a CMOS battery, allows the CMOS chip to remain powered to keep track of things like time even while the physical PC unit has no source of power. If there is no CMOS battery on the motherboard, the computer would reset to its default time each restart. The battery itself can die, as expected, if the computer is powered off and not used for a long period of time. This can cause issues with the main OS as well as the VM. [http://kb.iu.edu/data/adoy.html]&lt;br /&gt;
# Local APIC handles all external interrupts for the processor in the system. It can also accept and generate inter-processor interrupts between Local APICs. [http://developer.intel.com/design/pentium/datashts/24201606.pdf]&lt;br /&gt;
# ACPI (I will fill these in later, Nov. 29th Update) --[[User:Spanke|Spanke]]&lt;br /&gt;
# TSC&lt;br /&gt;
# HPET&lt;br /&gt;
&lt;br /&gt;
==Guest Timekeeping==&lt;br /&gt;
&lt;br /&gt;
Guest timekeeping is done using the same general methods as any computer timekeeping, using either tick counting or tickless systems. Where the two begin to differ, however, is that a host operating system is able to communicate directly with the physical hardware, while the guest operating system is unable to do so, having to communicate with the host system that it wants to communicate with the hardware. Having to do this is the greatest source of the guest operating system&#039;s clock losing accuracy, or more simply called drifting.&lt;br /&gt;
&lt;br /&gt;
===Sources of Drift===&lt;br /&gt;
&lt;br /&gt;
When a guest operating system is started, its clock simply synchronizes with the host&#039;s – some virtual machines such as VMware also do this when it is resumed from a suspended state, or restored from a snapshot – so it is easy to think that, since it starts off correctly the guest&#039;s clock will continue to be correct. That is, of course, incorrect. The first source of drift is simply due to the drift a host incurs in its own timekeeping. A clock is almost never entirely accurate, having a slight error due to the time used to communicate with the counter, even on the host system, and because the guest communicates with the host in order to keep track of its time, an error in the host&#039;s time is not only passed on to the guest, but because the host is trying to correct its own time the guest&#039;s request for a count is given slightly less priority, making it yet again lose accuracy. The larger the drift in the host, the larger the drift in the guest, as the host&#039;s drift simply compounds the issue.&lt;br /&gt;
&lt;br /&gt;
Aside from the host&#039;s own drift, the other cause of drift in the virtual environment is the fact that the it is treated like a process by the host. In and of itself this doesn&#039;t seem like a problem, but because of it it can be denied the CPU time required, or allocated less memory than needed. With restricted CPU time, it&#039;s easy for the requested ticks or requested read of a counter to pile up and create a backlog of requests, or simply receive the requested data late enough to throw its clock off. With memory, if the virtual environment does not have enough allocated to it by the host it can run into the problem of swapping out pages that are needed soon. Swapping the pages back in will momentarily bring the entire virtual environment to a halt, so ticks are missed and the clock falls behind.&lt;br /&gt;
&lt;br /&gt;
===Impact of Drift===&lt;br /&gt;
&lt;br /&gt;
The impact of drift essentially boils down to round-off errors and lost ticks. The practical impact of drift, however, is quite apparent in any automated system. For a relatable real-world example, though not in a virtual environment, in a factory&#039;s assembly line, the machinery is finely tuned to do its own specific part at certain intervals, and it generally does so with impressive efficiency. If the clock in the system were to drift, however, a specific machine may move too soon or too late, bringing the line to a potentially catastrophic halt. In a virtual environment, drift is a bit more subtle, as one result of it could be skewed process scheduling – some schedulers give a certain amount of time to a process before moving on, but if the guest&#039;s time has drifted substantially, when it tries to correct its time it could give more or less time to the processes in the scheduler.&lt;br /&gt;
&lt;br /&gt;
===Compensation Strategies===&lt;br /&gt;
&lt;br /&gt;
There are a number of compensation strategies for dealing with drift, depending on the cause of it. If the problem is due to CPU management issues, then the host can give more CPU time to the virtual machine, or it can lower the timer interrupt rate – or simply use a tickless counter. If it is due to a  memory management issue, allocating more memory to the virtual environment should prevent the system from needing to swap out page files so often.&lt;br /&gt;
&lt;br /&gt;
If the issue is from neither of those, but simply due to the inevitable lag when the guest communicates with the hardware via the host, then there are other methods to correct the drift. Most systems natively have algorithms built in to correct the time if it gets too far ahead or behind real time, though they are not without their own faults; if the time is set ahead when catching up, the backlog of ticks it has built up may not be cleared, so it could potentially set itself ahead multiple times until the backlog is dealt with. Tools built into the virtual machine itself can also deal with drift to an extent, as VMware Tools does. This kind of tool checks to see if the clock&#039;s error is within a certain margin. If it exceeds the margin, then the backlog is set to zero – to prevent the issue mentioned with the native algorithms – and resynchronizes with the host clock before the guest goes back to keeping track of time as it normally would.&lt;br /&gt;
&lt;br /&gt;
=Research problem=&lt;br /&gt;
&lt;br /&gt;
Today, the use of the Network Time Protocol and of daemons like ntpd is the dominant solution for accurate timekeeping. In optimal conditions, the ntpd can be very good but these situations rarely happen. Network congestion, disconnections, lower quality networking hardware and unsuspected system events can create offsets errors in the order of 10‘s or even 100 milliseconds(ms). [http://www.cubinlab.ee.unimelb.edu.au/~darryl/Publications/tscclock_final.pdf]&lt;br /&gt;
For demanding applications, this is neither robust or reliable. One way to enhance the performance of ntpd would be to poll from the NTP server more often as this would reduced the offset error but unfortunately, this would increase the network traffic which could cause network congestions which would raise the offset error. So this won’t work. &lt;br /&gt;
&lt;br /&gt;
Another problem with current system software clocks using NTP(like ntpd), is that they provide only an absolute clock.[http://www.cubinlab.ee.unimelb.edu.au/~darryl/Publications/synch_ToN.pdf]&lt;br /&gt;
So for applications that deals with network managements and measurements, this is unsuitable. Why? Because NTP focus on offset and not on hardware clock oscillator rate. For example, when calculating delay variations, the offset error doesn’t change anything to the calculations but the clocks’ oscillator rate variation does affect it. So having a more accurate timestamp would make those calculation more precise. Which mean we would need another system software clock.&lt;br /&gt;
&lt;br /&gt;
In virtualization(in this case Xen), when migrating a running system from one system to another can cause issues and this is again caused by the ntpd daemon. By default, each guest OS runs its own instance of the ntpd daemon. So the synchronization algorithm keeps track of the reference wallclock time, rate-of-drift and current clock error, which are defined by the hardware clock on the system. So when migrating the virtualized OS to another system, the ntpd state is saved and when it is enabled again on the new system, thats where the problems starts. Because no two hardware clocks drifts the same way or have the exact same wallclock time, all the information traced by the daemon are all of a sudden inaccurate. This could prove disastrous to the system. This could go from a slowly recoverable error to one where ntpd might never recover, making the virtualized OS unstable.&lt;br /&gt;
&lt;br /&gt;
=Contribution=&lt;br /&gt;
=Critique=&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. &amp;quot;Virtualize Everything But Time&amp;quot; by Timothy Broomhead, Laurence Cremean, Julien Ridoux and Darrel Veitch, 2010. http://www.usenix.org/events/osdi10/tech/full_papers/Broomhead.pdf&lt;br /&gt;
&lt;br /&gt;
2. &amp;quot;Timekeeping in Virtual Machines, Information Guide&amp;quot; from VMWare. http://www.vmware.com/files/pdf/Timekeeping-In-VirtualMachines.pdf&lt;br /&gt;
&lt;br /&gt;
3. &amp;quot;Bran&#039;s Kernel Development Tutorial&amp;quot; from Bona Fide OS Developer website. http://www.osdever.net/bkerndev/Docs/pit.htm  &lt;br /&gt;
&lt;br /&gt;
4. &amp;quot;What is a CMOS battery, and why does my computer need one?&amp;quot; from the Indiana University&#039;s Knowledge Base, 2010. http://kb.iu.edu/data/adoy.html&lt;br /&gt;
&lt;br /&gt;
5. &amp;quot;Multiprocessor Specification version 1.4&amp;quot; from Intel, 1997. http://developer.intel.com/design/pentium/datashts/24201606.pdf&lt;br /&gt;
&lt;br /&gt;
6. &lt;br /&gt;
&lt;br /&gt;
7. &amp;quot;PC Based Precision Timing Without GPS&amp;quot; by Attila Pa ́sztor and Darryl Veitch, 2002. http://www.cubinlab.ee.unimelb.edu.au/~darryl/Publications/tscclock_final.pdf&lt;br /&gt;
&lt;br /&gt;
8. &amp;quot;Robust Synchronization of Absolute and Difference Clocks over Networks&amp;quot; by Darryl Veitch, Julien Ridoux and Satish Babu Korada, 2009. http://www.cubinlab.ee.unimelb.edu.au/~darryl/Publications/synch_ToN.pdf&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_2_2010_Question_11&amp;diff=5944</id>
		<title>COMP 3000 Essay 2 2010 Question 11</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_2_2010_Question_11&amp;diff=5944"/>
		<updated>2010-12-01T17:41:22Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Virtualize Everything But Time =&lt;br /&gt;
Article written by Timothy Broomhead, Laurence Cremean, Julien Ridoux and Darrel Veitch. They are working for the Center for Ultra-Broadband Information Networks (CUBIN) Department of Electrical &amp;amp; Electronic Engineering at the University of Melbourne in Australia. Here is the link to the article: [http://www.usenix.org/events/osdi10/tech/full_papers/Broomhead.pdf]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Background Concepts=&lt;br /&gt;
&lt;br /&gt;
To better understand this paper, it is very important to have a good understanding of the general concepts breached in it. For example, we all know what clocks are in our day-to-day life but what are they in the context of computing? In this section, we will describe concepts like timekeeping, hardware/software clocks, the advantages and disadvantages of the different available counters, synchronization algorithms and explains what is a para-virtualized system.&lt;br /&gt;
&lt;br /&gt;
===Timekeeping===&lt;br /&gt;
&lt;br /&gt;
Since thousands of years, men have tried to find better ways to keep track of time. From sundials to atomic clocks, they were all made for the specific purpose of measuring the passage of time. This is not so different in computer operating systems. It is typically done in one of two ways: tick counting and tickless timekeeping[http://www.vmware.com/files/pdf/Timekeeping-In-VirtualMachines.pdf]. Tick counting is when the operating system sets up an hardware device, generally a CPU, to interrupt at a certain rate. So each time one of those interrupts are called(a tick), the operating system will keep track of it in a counter. That will tell the system how much time has passed. In tickless timekeeping, instead of the OS keeping track of time through interrupts, a hardware device is used instead starting its own counter when the system is booted. The OS just need to read the counter from it when needed. Tickless timekeeping seems to be the better way to keep track of time because it doesn’t hog the CPU with hardware interrupts however, its performance is very dependent on the type of hardware used. Another disadvantages is that they tend to drift and can cause inaccuracy. I will explains those drifts later. But both of these are just counters. They don’t know what is the actual real-time. To remedy that, either a computer gets its time from a battery-backed real-time clock or it queries a network time server(NTP) to get the current time. The computer can also use software in the form of a daemon that will run periodically to make adjustments to the time.&lt;br /&gt;
&lt;br /&gt;
===Clocks===&lt;br /&gt;
&lt;br /&gt;
Computer “clocks” or “timers” can be hardware based, software based or they can even be an hybrid. The most commonly found timer is the hardware timer. All of the hardware timers can be generally described by this diagram where some have either more or less features:&lt;br /&gt;
&lt;br /&gt;
Diagram1. Timer Abstraction&lt;br /&gt;
&lt;br /&gt;
[[File:Timerabstract.jpg]]&lt;br /&gt;
&lt;br /&gt;
This diagram nicely represent how tick counting works. The oscillator runs at a predetermine frequency. The operating system might have to mesure it when the system boots. The counter starts with a predetermined value which can be set by software. For every cycle of the oscillator, the counter counts down one unit. When it reaches zero, its generates an output signal that might interrupt the CPU. That same interrupt will then allow the counter’s initial value to be reloaded into the counter and the process begins again. As I said earlier, not all hardware timer works exactly like that. Some actually counts up, doesn&#039;t use interrupts or doesn&#039;t have an initial counter value but they still follow the same principle.&lt;br /&gt;
&lt;br /&gt;
===Timers===&lt;br /&gt;
# PIT is useful for generating interrupts at regular intervals through its three channels. Channel 0 is bound to IRQ0 which interrupts the CPU at regular intervals. Channel 1 is specific to each system and Channel 2 is connected to the speaker system. As such, we only need to concern ourselves with Channel 0. [http://www.osdever.net/bkerndev/Docs/pit.htm]&lt;br /&gt;
# CMOS RTC, also known as a CMOS battery, allows the CMOS chip to remain powered to keep track of things like time even while the physical PC unit has no source of power. If there is no CMOS battery on the motherboard, the computer would reset to its default time each restart. The battery itself can die, as expected, if the computer is powered off and not used for a long period of time. This can cause issues with the main OS as well as the VM. [http://kb.iu.edu/data/adoy.html]&lt;br /&gt;
# Local APIC handles all external interrupts for the processor in the system. It can also accept and generate inter-processor interrupts between Local APICs. [http://developer.intel.com/design/pentium/datashts/24201606.pdf]&lt;br /&gt;
# ACPI (I will fill these in later, Nov. 29th Update) --[[User:Spanke|Spanke]]&lt;br /&gt;
# TSC&lt;br /&gt;
# HPET&lt;br /&gt;
&lt;br /&gt;
==Guest Timekeeping==&lt;br /&gt;
&lt;br /&gt;
Guest timekeeping is done using the same general methods as any computer timekeeping, using either tick counting or tickless systems. Where the two begin to differ, however, is that a host operating system is able to communicate directly with the physical hardware, while the guest operating system is unable to do so, having to communicate with the host system that it wants to communicate with the hardware. Having to do this is the greatest source of the guest operating system&#039;s clock losing accuracy, or more simply called drifting.&lt;br /&gt;
&lt;br /&gt;
===Sources of Drift===&lt;br /&gt;
&lt;br /&gt;
When a guest operating system is started, its clock simply synchronizes with the host&#039;s – some virtual machines such as VMware also do this when it is resumed from a suspended state, or restored from a snapshot – so it is easy to think that, since it starts off correctly the guest&#039;s clock will continue to be correct. That is, of course, incorrect. The first source of drift is simply due to the drift a host incurs in its own timekeeping. A clock is almost never entirely accurate, having a slight error due to the time used to communicate with the counter, even on the host system, and because the guest communicates with the host in order to keep track of its time, an error in the host&#039;s time is not only passed on to the guest, but because the host is trying to correct its own time the guest&#039;s request for a count is given slightly less priority, making it yet again lose accuracy. The larger the drift in the host, the larger the drift in the guest, as the host&#039;s drift simply compounds the issue.&lt;br /&gt;
&lt;br /&gt;
Aside from the host&#039;s own drift, the other cause of drift in the virtual environment is the fact that the it is treated like a process by the host. In and of itself this doesn&#039;t seem like a problem, but because of it it can be denied the CPU time required, or allocated less memory than needed. With restricted CPU time, it&#039;s easy for the requested ticks or requested read of a counter to pile up and create a backlog of requests, or simply receive the requested data late enough to throw its clock off. With memory, if the virtual environment does not have enough allocated to it by the host it can run into the problem of swapping out pages that are needed soon. Swapping the pages back in will momentarily bring the entire virtual environment to a halt, so ticks are missed and the clock falls behind.&lt;br /&gt;
&lt;br /&gt;
===Impact of Drift===&lt;br /&gt;
&lt;br /&gt;
The impact of drift essentially boils down to round-off errors and lost ticks. The practical impact of drift, however, is quite apparent in any automated system. For a relatable real-world example, though not in a virtual environment, in a factory&#039;s assembly line, the machinery is finely tuned to do its own specific part at certain intervals, and it generally does so with impressive efficiency. If the clock in the system were to drift, however, a specific machine may move too soon or too late, bringing the line to a potentially catastrophic halt. In a virtual environment, drift is a bit more subtle, as one result of it could be skewed process scheduling – some schedulers give a certain amount of time to a process before moving on, but if the guest&#039;s time has drifted substantially, when it tries to correct its time it could give more or less time to the processes in the scheduler.&lt;br /&gt;
&lt;br /&gt;
===Compensation Strategies===&lt;br /&gt;
&lt;br /&gt;
There are a number of compensation strategies for dealing with drift, depending on the cause of it. If the problem is due to CPU management issues, then the host can give more CPU time to the virtual machine, or it can lower the timer interrupt rate – or simply use a tickless counter. If it is due to a  memory management issue, allocating more memory to the virtual environment should prevent the system from needing to swap out page files so often.&lt;br /&gt;
&lt;br /&gt;
If the issue is from neither of those, but simply due to the inevitable lag when the guest communicates with the hardware via the host, then there are other methods to correct the drift. Most systems natively have algorithms built in to correct the time if it gets too far ahead or behind real time, though they are not without their own faults; if the time is set ahead when catching up, the backlog of ticks it has built up may not be cleared, so it could potentially set itself ahead multiple times until the backlog is dealt with. Tools built into the virtual machine itself can also deal with drift to an extent, as VMware Tools does. This kind of tool checks to see if the clock&#039;s error is within a certain margin. If it exceeds the margin, then the backlog is set to zero – to prevent the issue mentioned with the native algorithms – and resynchronizes with the host clock before the guest goes back to keeping track of time as it normally would.&lt;br /&gt;
&lt;br /&gt;
=Research problem=&lt;br /&gt;
&lt;br /&gt;
Today, the use of the Network Time Protocol and of daemons like ntpd is the dominant solution for accurate timekeeping. In optimal conditions, the ntpd can be very good but these situations rarely happen. Network congestion, disconnections, lower quality networking hardware and unsuspected system events can create offsets errors in the order of 10‘s or even 100 milliseconds(ms). [http://www.cubinlab.ee.unimelb.edu.au/~darryl/Publications/tscclock_final.pdf]&lt;br /&gt;
For demanding applications, this is neither robust or reliable. One way to enhance the performance of ntpd would be to poll from the NTP server more often as this would reduced the offset error but unfortunately, this would increase the network traffic which could cause network congestions which would raise the offset error. So this won’t work. &lt;br /&gt;
&lt;br /&gt;
Another problem with current system software clocks using NTP(like ntpd), is that they provide only an absolute clock.[http://www.cubinlab.ee.unimelb.edu.au/~darryl/Publications/synch_ToN.pdf]&lt;br /&gt;
So for applications that deals with network managements and measurements, this is unsuitable. Why? Because NTP focus on offset and not on hardware clock oscillator rate. For example, when calculating delay variations, the offset error doesn’t change anything to the calculations but the clocks’ oscillator rate variation does affect it. So having a more accurate timestamp would make those calculation more precise. Which mean we would need another system software clock.&lt;br /&gt;
&lt;br /&gt;
In virtualization(in this case Xen), when migrating a running system from one system to another can cause issues and this is again caused by the ntpd daemon. By default, each guest OS runs its own instance of the ntpd daemon. So the synchronization algorithm keeps track of the reference wallclock time, rate-of-drift and current clock error, which are defined by the hardware clock on the system. So when migrating the virtualized OS to another system, the ntpd state is saved and when it is enabled again on the new system, thats where the problems starts. Because no two hardware clocks drifts the same way or have the exact same wallclock time, all the information traced by the daemon are all of a sudden inaccurate. This could prove disastrous to the system. This could go from a slowly recoverable error to one where ntpd might never recover, making the virtualized OS unstable.&lt;br /&gt;
&lt;br /&gt;
=Contribution=&lt;br /&gt;
=Critique=&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. &amp;quot;Virtualize Everything But Time&amp;quot; by Timothy Broomhead, Laurence Cremean, Julien Ridoux and Darrel Veitch, 2010. http://www.usenix.org/events/osdi10/tech/full_papers/Broomhead.pdf&lt;br /&gt;
&lt;br /&gt;
2. &amp;quot;Timekeeping in Virtual Machines, Information Guide&amp;quot; from VMWare. http://www.vmware.com/files/pdf/Timekeeping-In-VirtualMachines.pdf&lt;br /&gt;
&lt;br /&gt;
3. &amp;quot;Bran&#039;s Kernel Development Tutorial&amp;quot; from Bona Fide OS Developer website. http://www.osdever.net/bkerndev/Docs/pit.htm  &lt;br /&gt;
&lt;br /&gt;
4. &lt;br /&gt;
&lt;br /&gt;
7. &amp;quot;PC Based Precision Timing Without GPS&amp;quot; by Attila Pa ́sztor and Darryl Veitch, 2002. http://www.cubinlab.ee.unimelb.edu.au/~darryl/Publications/tscclock_final.pdf&lt;br /&gt;
&lt;br /&gt;
8. &amp;quot;Robust Synchronization of Absolute and Difference Clocks over Networks&amp;quot; by Darryl Veitch, Julien Ridoux and Satish Babu Korada, 2009. http://www.cubinlab.ee.unimelb.edu.au/~darryl/Publications/synch_ToN.pdf&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_2_2010_Question_11&amp;diff=5943</id>
		<title>COMP 3000 Essay 2 2010 Question 11</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_2_2010_Question_11&amp;diff=5943"/>
		<updated>2010-12-01T17:37:19Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Virtualize Everything But Time =&lt;br /&gt;
Article written by Timothy Broomhead, Laurence Cremean, Julien Ridoux and Darrel Veitch. They are working for the Center for Ultra-Broadband Information Networks (CUBIN) Department of Electrical &amp;amp; Electronic Engineering at the University of Melbourne in Australia. Here is the link to the article: [http://www.usenix.org/events/osdi10/tech/full_papers/Broomhead.pdf]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Background Concepts=&lt;br /&gt;
&lt;br /&gt;
To better understand this paper, it is very important to have a good understanding of the general concepts breached in it. For example, we all know what clocks are in our day-to-day life but what are they in the context of computing? In this section, we will describe concepts like timekeeping, hardware/software clocks, the advantages and disadvantages of the different available counters, synchronization algorithms and explains what is a para-virtualized system.&lt;br /&gt;
&lt;br /&gt;
===Timekeeping===&lt;br /&gt;
&lt;br /&gt;
Since thousands of years, men have tried to find better ways to keep track of time. From sundials to atomic clocks, they were all made for the specific purpose of measuring the passage of time. This is not so different in computer operating systems. It is typically done in one of two ways: tick counting and tickless timekeeping[http://www.vmware.com/files/pdf/Timekeeping-In-VirtualMachines.pdf]. Tick counting is when the operating system sets up an hardware device, generally a CPU, to interrupt at a certain rate. So each time one of those interrupts are called(a tick), the operating system will keep track of it in a counter. That will tell the system how much time has passed. In tickless timekeeping, instead of the OS keeping track of time through interrupts, a hardware device is used instead starting its own counter when the system is booted. The OS just need to read the counter from it when needed. Tickless timekeeping seems to be the better way to keep track of time because it doesn’t hog the CPU with hardware interrupts however, its performance is very dependent on the type of hardware used. Another disadvantages is that they tend to drift and can cause inaccuracy. I will explains those drifts later. But both of these are just counters. They don’t know what is the actual real-time. To remedy that, either a computer gets its time from a battery-backed real-time clock or it queries a network time server(NTP) to get the current time. The computer can also use software in the form of a daemon that will run periodically to make adjustments to the time.&lt;br /&gt;
&lt;br /&gt;
===Clocks===&lt;br /&gt;
&lt;br /&gt;
Computer “clocks” or “timers” can be hardware based, software based or they can even be an hybrid. The most commonly found timer is the hardware timer. All of the hardware timers can be generally described by this diagram where some have either more or less features:&lt;br /&gt;
&lt;br /&gt;
Diagram1. Timer Abstraction&lt;br /&gt;
&lt;br /&gt;
[[File:Timerabstract.jpg]]&lt;br /&gt;
&lt;br /&gt;
This diagram nicely represent how tick counting works. The oscillator runs at a predetermine frequency. The operating system might have to mesure it when the system boots. The counter starts with a predetermined value which can be set by software. For every cycle of the oscillator, the counter counts down one unit. When it reaches zero, its generates an output signal that might interrupt the CPU. That same interrupt will then allow the counter’s initial value to be reloaded into the counter and the process begins again. As I said earlier, not all hardware timer works exactly like that. Some actually counts up, doesn&#039;t use interrupts or doesn&#039;t have an initial counter value but they still follow the same principle.&lt;br /&gt;
&lt;br /&gt;
===Timers===&lt;br /&gt;
# PIT is useful for generating interrupts at regular intervals through its three channels. Channel 0 is bound to IRQ0 which interrupts the CPU at regular intervals. Channel 1 is specific to each system and Channel 2 is connected to the speaker system. As such, we only need to concern ourselves with Channel 0. [http://www.osdever.net/bkerndev/Docs/pit.htm]&lt;br /&gt;
# CMOS RTC, also known as a CMOS battery, allows the CMOS chip to remain powered to keep track of things like time even while the physical PC unit has no source of power. If there is no CMOS battery on the motherboard, the computer would reset to its default time each restart. The battery itself can die, as expected, if the computer is powered off and not used for a long period of time. This can cause issues with the main OS as well as the VM. [http://kb.iu.edu/data/adoy.html]&lt;br /&gt;
# Local APIC handles all external interrupts for the processor in the system. It can also accept and generate inter-processor interrupts between Local APICs. [http://developer.intel.com/design/pentium/datashts/24201606.pdf]&lt;br /&gt;
# ACPI (I will fill these in later, Nov. 29th Update) --[[User:Spanke|Spanke]]&lt;br /&gt;
# TSC&lt;br /&gt;
# HPET&lt;br /&gt;
&lt;br /&gt;
==Guest Timekeeping==&lt;br /&gt;
&lt;br /&gt;
Guest timekeeping is done using the same general methods as any computer timekeeping, using either tick counting or tickless systems. Where the two begin to differ, however, is that a host operating system is able to communicate directly with the physical hardware, while the guest operating system is unable to do so, having to communicate with the host system that it wants to communicate with the hardware. Having to do this is the greatest source of the guest operating system&#039;s clock losing accuracy, or more simply called drifting.&lt;br /&gt;
&lt;br /&gt;
===Sources of Drift===&lt;br /&gt;
&lt;br /&gt;
When a guest operating system is started, its clock simply synchronizes with the host&#039;s – some virtual machines such as VMware also do this when it is resumed from a suspended state, or restored from a snapshot – so it is easy to think that, since it starts off correctly the guest&#039;s clock will continue to be correct. That is, of course, incorrect. The first source of drift is simply due to the drift a host incurs in its own timekeeping. A clock is almost never entirely accurate, having a slight error due to the time used to communicate with the counter, even on the host system, and because the guest communicates with the host in order to keep track of its time, an error in the host&#039;s time is not only passed on to the guest, but because the host is trying to correct its own time the guest&#039;s request for a count is given slightly less priority, making it yet again lose accuracy. The larger the drift in the host, the larger the drift in the guest, as the host&#039;s drift simply compounds the issue.&lt;br /&gt;
&lt;br /&gt;
Aside from the host&#039;s own drift, the other cause of drift in the virtual environment is the fact that the it is treated like a process by the host. In and of itself this doesn&#039;t seem like a problem, but because of it it can be denied the CPU time required, or allocated less memory than needed. With restricted CPU time, it&#039;s easy for the requested ticks or requested read of a counter to pile up and create a backlog of requests, or simply receive the requested data late enough to throw its clock off. With memory, if the virtual environment does not have enough allocated to it by the host it can run into the problem of swapping out pages that are needed soon. Swapping the pages back in will momentarily bring the entire virtual environment to a halt, so ticks are missed and the clock falls behind.&lt;br /&gt;
&lt;br /&gt;
===Impact of Drift===&lt;br /&gt;
&lt;br /&gt;
The impact of drift essentially boils down to round-off errors and lost ticks. The practical impact of drift, however, is quite apparent in any automated system. For a relatable real-world example, though not in a virtual environment, in a factory&#039;s assembly line, the machinery is finely tuned to do its own specific part at certain intervals, and it generally does so with impressive efficiency. If the clock in the system were to drift, however, a specific machine may move too soon or too late, bringing the line to a potentially catastrophic halt. In a virtual environment, drift is a bit more subtle, as one result of it could be skewed process scheduling – some schedulers give a certain amount of time to a process before moving on, but if the guest&#039;s time has drifted substantially, when it tries to correct its time it could give more or less time to the processes in the scheduler.&lt;br /&gt;
&lt;br /&gt;
===Compensation Strategies===&lt;br /&gt;
&lt;br /&gt;
There are a number of compensation strategies for dealing with drift, depending on the cause of it. If the problem is due to CPU management issues, then the host can give more CPU time to the virtual machine, or it can lower the timer interrupt rate – or simply use a tickless counter. If it is due to a  memory management issue, allocating more memory to the virtual environment should prevent the system from needing to swap out page files so often.&lt;br /&gt;
&lt;br /&gt;
If the issue is from neither of those, but simply due to the inevitable lag when the guest communicates with the hardware via the host, then there are other methods to correct the drift. Most systems natively have algorithms built in to correct the time if it gets too far ahead or behind real time, though they are not without their own faults; if the time is set ahead when catching up, the backlog of ticks it has built up may not be cleared, so it could potentially set itself ahead multiple times until the backlog is dealt with. Tools built into the virtual machine itself can also deal with drift to an extent, as VMware Tools does. This kind of tool checks to see if the clock&#039;s error is within a certain margin. If it exceeds the margin, then the backlog is set to zero – to prevent the issue mentioned with the native algorithms – and resynchronizes with the host clock before the guest goes back to keeping track of time as it normally would.&lt;br /&gt;
&lt;br /&gt;
=Research problem=&lt;br /&gt;
&lt;br /&gt;
Today, the use of the Network Time Protocol and of daemons like ntpd is the dominant solution for accurate timekeeping. In optimal conditions, the ntpd can be very good but these situations rarely happen. Network congestion, disconnections, lower quality networking hardware and unsuspected system events can create offsets errors in the order of 10‘s or even 100 milliseconds(ms). [http://www.cubinlab.ee.unimelb.edu.au/~darryl/Publications/tscclock_final.pdf]&lt;br /&gt;
For demanding applications, this is neither robust or reliable. One way to enhance the performance of ntpd would be to poll from the NTP server more often as this would reduced the offset error but unfortunately, this would increase the network traffic which could cause network congestions which would raise the offset error. So this won’t work. &lt;br /&gt;
&lt;br /&gt;
Another problem with current system software clocks using NTP(like ntpd), is that they provide only an absolute clock.[http://www.cubinlab.ee.unimelb.edu.au/~darryl/Publications/synch_ToN.pdf]&lt;br /&gt;
So for applications that deals with network managements and measurements, this is unsuitable. Why? Because NTP focus on offset and not on hardware clock oscillator rate. For example, when calculating delay variations, the offset error doesn’t change anything to the calculations but the clocks’ oscillator rate variation does affect it. So having a more accurate timestamp would make those calculation more precise. Which mean we would need another system software clock.&lt;br /&gt;
&lt;br /&gt;
In virtualization(in this case Xen), when migrating a running system from one system to another can cause issues and this is again caused by the ntpd daemon. By default, each guest OS runs its own instance of the ntpd daemon. So the synchronization algorithm keeps track of the reference wallclock time, rate-of-drift and current clock error, which are defined by the hardware clock on the system. So when migrating the virtualized OS to another system, the ntpd state is saved and when it is enabled again on the new system, thats where the problems starts. Because no two hardware clocks drifts the same way or have the exact same wallclock time, all the information traced by the daemon are all of a sudden inaccurate. This could prove disastrous to the system. This could go from a slowly recoverable error to one where ntpd might never recover, making the virtualized OS unstable.&lt;br /&gt;
&lt;br /&gt;
=Contribution=&lt;br /&gt;
=Critique=&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. &amp;quot;Virtualize Everything But Time&amp;quot; by Timothy Broomhead, Laurence Cremean, Julien Ridoux and Darrel Veitch, 2010. http://www.usenix.org/events/osdi10/tech/full_papers/Broomhead.pdf&lt;br /&gt;
&lt;br /&gt;
2. &amp;quot;Timekeeping in Virtual Machines, Information Guide&amp;quot; from VMWare. http://www.vmware.com/files/pdf/Timekeeping-In-VirtualMachines.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
7. &amp;quot;PC Based Precision Timing Without GPS&amp;quot; by Attila Pa ́sztor and Darryl Veitch, 2002. http://www.cubinlab.ee.unimelb.edu.au/~darryl/Publications/tscclock_final.pdf&lt;br /&gt;
&lt;br /&gt;
8. &amp;quot;Robust Synchronization of Absolute and Difference Clocks over Networks&amp;quot; by Darryl Veitch, Julien Ridoux and Satish Babu Korada, 2009. http://www.cubinlab.ee.unimelb.edu.au/~darryl/Publications/synch_ToN.pdf&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_2_2010_Question_11&amp;diff=5942</id>
		<title>COMP 3000 Essay 2 2010 Question 11</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_2_2010_Question_11&amp;diff=5942"/>
		<updated>2010-12-01T17:32:01Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Virtualize Everything But Time =&lt;br /&gt;
Article written by Timothy Broomhead, Laurence Cremean, Julien Ridoux and Darrel Veitch. They are working for the Center for Ultra-Broadband Information Networks (CUBIN) Department of Electrical &amp;amp; Electronic Engineering at the University of Melbourne in Australia. Here is the link to the article: [http://www.usenix.org/events/osdi10/tech/full_papers/Broomhead.pdf]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Background Concepts=&lt;br /&gt;
&lt;br /&gt;
To better understand this paper, it is very important to have a good understanding of the general concepts breached in it. For example, we all know what clocks are in our day-to-day life but what are they in the context of computing? In this section, we will describe concepts like timekeeping, hardware/software clocks, the advantages and disadvantages of the different available counters, synchronization algorithms and explains what is a para-virtualized system.&lt;br /&gt;
&lt;br /&gt;
===Timekeeping===&lt;br /&gt;
&lt;br /&gt;
Since thousands of years, men have tried to find better ways to keep track of time. From sundials to atomic clocks, they were all made for the specific purpose of measuring the passage of time. This is not so different in computer operating systems. It is typically done in one of two ways: tick counting and tickless timekeeping[http://www.vmware.com/files/pdf/Timekeeping-In-VirtualMachines.pdf]. Tick counting is when the operating system sets up an hardware device, generally a CPU, to interrupt at a certain rate. So each time one of those interrupts are called(a tick), the operating system will keep track of it in a counter. That will tell the system how much time has passed. In tickless timekeeping, instead of the OS keeping track of time through interrupts, a hardware device is used instead starting its own counter when the system is booted. The OS just need to read the counter from it when needed. Tickless timekeeping seems to be the better way to keep track of time because it doesn’t hog the CPU with hardware interrupts however, its performance is very dependent on the type of hardware used. Another disadvantages is that they tend to drift and can cause inaccuracy. I will explains those drifts later. But both of these are just counters. They don’t know what is the actual real-time. To remedy that, either a computer gets its time from a battery-backed real-time clock or it queries a network time server(NTP) to get the current time. The computer can also use software in the form of a daemon that will run periodically to make adjustments to the time.&lt;br /&gt;
&lt;br /&gt;
===Clocks===&lt;br /&gt;
&lt;br /&gt;
Computer “clocks” or “timers” can be hardware based, software based or they can even be an hybrid. The most commonly found timer is the hardware timer. All of the hardware timers can be generally described by this diagram where some have either more or less features:&lt;br /&gt;
&lt;br /&gt;
Diagram1. Timer Abstraction&lt;br /&gt;
&lt;br /&gt;
[[File:Timerabstract.jpg]]&lt;br /&gt;
&lt;br /&gt;
This diagram nicely represent how tick counting works. The oscillator runs at a predetermine frequency. The operating system might have to mesure it when the system boots. The counter starts with a predetermined value which can be set by software. For every cycle of the oscillator, the counter counts down one unit. When it reaches zero, its generates an output signal that might interrupt the CPU. That same interrupt will then allow the counter’s initial value to be reloaded into the counter and the process begins again. As I said earlier, not all hardware timer works exactly like that. Some actually counts up, doesn&#039;t use interrupts or doesn&#039;t have an initial counter value but they still follow the same principle.&lt;br /&gt;
&lt;br /&gt;
===Timers===&lt;br /&gt;
# PIT is useful for generating interrupts at regular intervals through its three channels. Channel 0 is bound to IRQ0 which interrupts the CPU at regular intervals. Channel 1 is specific to each system and Channel 2 is connected to the speaker system. As such, we only need to concern ourselves with Channel 0. [http://www.osdever.net/bkerndev/Docs/pit.htm]&lt;br /&gt;
# CMOS RTC, also known as a CMOS battery, allows the CMOS chip to remain powered to keep track of things like time even while the physical PC unit has no source of power. If there is no CMOS battery on the motherboard, the computer would reset to its default time each restart. The battery itself can die, as expected, if the computer is powered off and not used for a long period of time. This can cause issues with the main OS as well as the VM. [http://kb.iu.edu/data/adoy.html]&lt;br /&gt;
# Local APIC handles all external interrupts for the processor in the system. It can also accept and generate inter-processor interrupts between Local APICs. [http://developer.intel.com/design/pentium/datashts/24201606.pdf]&lt;br /&gt;
# ACPI (I will fill these in later, Nov. 29th Update) --[[User:Spanke|Spanke]]&lt;br /&gt;
# TSC&lt;br /&gt;
# HPET&lt;br /&gt;
&lt;br /&gt;
==Guest Timekeeping==&lt;br /&gt;
&lt;br /&gt;
Guest timekeeping is done using the same general methods as any computer timekeeping, using either tick counting or tickless systems. Where the two begin to differ, however, is that a host operating system is able to communicate directly with the physical hardware, while the guest operating system is unable to do so, having to communicate with the host system that it wants to communicate with the hardware. Having to do this is the greatest source of the guest operating system&#039;s clock losing accuracy, or more simply called drifting.&lt;br /&gt;
&lt;br /&gt;
===Sources of Drift===&lt;br /&gt;
&lt;br /&gt;
When a guest operating system is started, its clock simply synchronizes with the host&#039;s – some virtual machines such as VMware also do this when it is resumed from a suspended state, or restored from a snapshot – so it is easy to think that, since it starts off correctly the guest&#039;s clock will continue to be correct. That is, of course, incorrect. The first source of drift is simply due to the drift a host incurs in its own timekeeping. A clock is almost never entirely accurate, having a slight error due to the time used to communicate with the counter, even on the host system, and because the guest communicates with the host in order to keep track of its time, an error in the host&#039;s time is not only passed on to the guest, but because the host is trying to correct its own time the guest&#039;s request for a count is given slightly less priority, making it yet again lose accuracy. The larger the drift in the host, the larger the drift in the guest, as the host&#039;s drift simply compounds the issue.&lt;br /&gt;
&lt;br /&gt;
Aside from the host&#039;s own drift, the other cause of drift in the virtual environment is the fact that the it is treated like a process by the host. In and of itself this doesn&#039;t seem like a problem, but because of it it can be denied the CPU time required, or allocated less memory than needed. With restricted CPU time, it&#039;s easy for the requested ticks or requested read of a counter to pile up and create a backlog of requests, or simply receive the requested data late enough to throw its clock off. With memory, if the virtual environment does not have enough allocated to it by the host it can run into the problem of swapping out pages that are needed soon. Swapping the pages back in will momentarily bring the entire virtual environment to a halt, so ticks are missed and the clock falls behind.&lt;br /&gt;
&lt;br /&gt;
===Impact of Drift===&lt;br /&gt;
&lt;br /&gt;
The impact of drift essentially boils down to round-off errors and lost ticks. The practical impact of drift, however, is quite apparent in any automated system. For a relatable real-world example, though not in a virtual environment, in a factory&#039;s assembly line, the machinery is finely tuned to do its own specific part at certain intervals, and it generally does so with impressive efficiency. If the clock in the system were to drift, however, a specific machine may move too soon or too late, bringing the line to a potentially catastrophic halt. In a virtual environment, drift is a bit more subtle, as one result of it could be skewed process scheduling – some schedulers give a certain amount of time to a process before moving on, but if the guest&#039;s time has drifted substantially, when it tries to correct its time it could give more or less time to the processes in the scheduler.&lt;br /&gt;
&lt;br /&gt;
===Compensation Strategies===&lt;br /&gt;
&lt;br /&gt;
There are a number of compensation strategies for dealing with drift, depending on the cause of it. If the problem is due to CPU management issues, then the host can give more CPU time to the virtual machine, or it can lower the timer interrupt rate – or simply use a tickless counter. If it is due to a  memory management issue, allocating more memory to the virtual environment should prevent the system from needing to swap out page files so often.&lt;br /&gt;
&lt;br /&gt;
If the issue is from neither of those, but simply due to the inevitable lag when the guest communicates with the hardware via the host, then there are other methods to correct the drift. Most systems natively have algorithms built in to correct the time if it gets too far ahead or behind real time, though they are not without their own faults; if the time is set ahead when catching up, the backlog of ticks it has built up may not be cleared, so it could potentially set itself ahead multiple times until the backlog is dealt with. Tools built into the virtual machine itself can also deal with drift to an extent, as VMware Tools does. This kind of tool checks to see if the clock&#039;s error is within a certain margin. If it exceeds the margin, then the backlog is set to zero – to prevent the issue mentioned with the native algorithms – and resynchronizes with the host clock before the guest goes back to keeping track of time as it normally would.&lt;br /&gt;
&lt;br /&gt;
=Research problem=&lt;br /&gt;
&lt;br /&gt;
Today, the use of the Network Time Protocol and of daemons like ntpd is the dominant solution for accurate timekeeping. In optimal conditions, the ntpd can be very good but these situations rarely happen. Network congestion, disconnections, lower quality networking hardware and unsuspected system events can create offsets errors in the order of 10‘s or even 100 milliseconds(ms). [http://www.cubinlab.ee.unimelb.edu.au/~darryl/Publications/tscclock_final.pdf]&lt;br /&gt;
For demanding applications, this is neither robust or reliable. One way to enhance the performance of ntpd would be to poll from the NTP server more often as this would reduced the offset error but unfortunately, this would increase the network traffic which could cause network congestions which would raise the offset error. So this won’t work. &lt;br /&gt;
&lt;br /&gt;
Another problem with current system software clocks using NTP(like ntpd), is that they provide only an absolute clock.[http://www.cubinlab.ee.unimelb.edu.au/~darryl/Publications/synch_ToN.pdf]&lt;br /&gt;
So for applications that deals with network managements and measurements, this is unsuitable. Why? Because NTP focus on offset and not on hardware clock oscillator rate. For example, when calculating delay variations, the offset error doesn’t change anything to the calculations but the clocks’ oscillator rate variation does affect it. So having a more accurate timestamp would make those calculation more precise. Which mean we would need another system software clock.&lt;br /&gt;
&lt;br /&gt;
In virtualization(in this case Xen), when migrating a running system from one system to another can cause issues and this is again caused by the ntpd daemon. By default, each guest OS runs its own instance of the ntpd daemon. So the synchronization algorithm keeps track of the reference wallclock time, rate-of-drift and current clock error, which are defined by the hardware clock on the system. So when migrating the virtualized OS to another system, the ntpd state is saved and when it is enabled again on the new system, thats where the problems starts. Because no two hardware clocks drifts the same way or have the exact same wallclock time, all the information traced by the daemon are all of a sudden inaccurate. This could prove disastrous to the system. This could go from a slowly recoverable error to one where ntpd might never recover, making the virtualized OS unstable.&lt;br /&gt;
&lt;br /&gt;
=Contribution=&lt;br /&gt;
=Critique=&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. Virtualize Everything But Time by Timothy Broomhead, Laurence Cremean, Julien Ridoux and Darrel Veitch, 2010. http://www.usenix.org/events/osdi10/tech/full_papers/Broomhead.pdf&lt;br /&gt;
&lt;br /&gt;
2. Timekeeping in Virtual Machines, Information Guide from VMWare. http://www.vmware.com/files/pdf/Timekeeping-In-VirtualMachines.pdf&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=Talk:COMP_3000_Essay_2_2010_Question_11&amp;diff=5930</id>
		<title>Talk:COMP 3000 Essay 2 2010 Question 11</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=Talk:COMP_3000_Essay_2_2010_Question_11&amp;diff=5930"/>
		<updated>2010-12-01T15:11:42Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;--[[User:Sblais2|Sblais2]] 15:11, 1 December 2010 (UTC) Would it be possible to add your references at the bottom please? Even if it is a link. I have added the article link at the top of the essay.&lt;br /&gt;
&lt;br /&gt;
Hey guys, sorry its taken me a while to post here. If there is a particular topic that needs researching, I could spend some hours doing that tomorrow - suggestions? Also, I intend to fix up the style&amp;amp;structure after everything is done as I am quite good with that. &lt;br /&gt;
&lt;br /&gt;
Fedor&lt;br /&gt;
&lt;br /&gt;
--[[User:ScottG|ScottG]] 21:36, 26 November 2010 (UTC) So I was a little (more than a little) behind on my initially estimated time for getting stuff up on Guest Timekeeping, but that&#039;s the gist of it there now. I&#039;m going to try to buff it up a bit before it&#039;s due, since what I put in is a bit rougher than I&#039;d like. If I seem to be missing something that should be pretty obvious, let me know and I&#039;ll work it in.&lt;br /&gt;
&lt;br /&gt;
--[[User:Jjpwilso|Jjpwilso]] 15:49, 23 November 2010 (UTC) I&#039;ve been completely swamped with COMP3004 stuff (among other things) and feeling guilty as hell about this essay. The good news, for those who might have missed today&#039;s lecture, is we have an extension of one week. Phew!!&lt;br /&gt;
&lt;br /&gt;
--[[User:Sblais2|Sblais2]] 21:29, 22 November 2010 (UTC) I have added a small part to the background section. I have created by hand a diagram explaining how it works. I tried to find an original way of doing it but it is the same diagram everywhere. Please feel free to comment here or by sending me an email.&lt;br /&gt;
&lt;br /&gt;
--[[User:AbsMechanik|AbsMechanik]] 19:46, 22 November 2010 (UTC) Here&#039;s what my research has led me to so far. I&#039;m trying to come up with good points for the research problem, contribution and critique part of this essay. Here&#039;s a bunch of links, I&#039;ve come across. I think there will be a few more tonight. Feel free to read through &#039;em: &lt;br /&gt;
&amp;lt;br&amp;gt;http://www.vmware.com/files/pdf/Timekeeping-In-VirtualMachines.pdf&lt;br /&gt;
&amp;lt;br&amp;gt;http://www.xen.org/files/xen_interface.pdf&lt;br /&gt;
&amp;lt;br&amp;gt;http://www.microsoft.com/whdc/system/sysinternals/mm-timer.mspx&lt;br /&gt;
&amp;lt;br&amp;gt;http://www.intel.com/hardwaredesign/hpetspec_1.pdf&lt;br /&gt;
&amp;lt;br&amp;gt;http://www.cubinlab.ee.unimelb.edu.au/radclock/&lt;br /&gt;
&lt;br /&gt;
--[[User:ScottG|ScottG]] 18:55, 22 November 2010 (UTC) I&#039;m good taking the Guest Timekeeping section. Hopefully I&#039;ll have some stuff up tonight or early tomorrow for it.&lt;br /&gt;
&lt;br /&gt;
--[[User:Sblais2|Sblais2]] 17:14, 22 November 2010 (UTC) I will be working on the Background section. I will dedicate it to explain some of the key concepts that are used in the research paper that will allow the readers to have a better understanding on the rest of our essay. The structure you&#039;ve put in place looks good but it might get modified, depending on the text will flow. The diagram is a good idea. I will drawn a simple one and add it in. Feel free again to critique.&lt;br /&gt;
&lt;br /&gt;
--[[User:Jjpwilso|Jjpwilso]] 15:12, 16 November 2010 (UTC) I wanted to get a structure started, so I have stubbed out the first section. Note: some of the sub-sections might belong in the Research Problem section but we can easily move them if they fit there. Let&#039;s use this area to plan who is doing what. Feel free to critique any of my submissions. When you comment here, please put your comments at the very top so we can easily see recent posts.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Participants=&lt;br /&gt;
(X) Blais   Sylvain sblais2 - Email: syl20blais@gmail.com&amp;lt;br&amp;gt;&lt;br /&gt;
(X) Graham  Scott   sgraham6&amp;lt;br&amp;gt;&lt;br /&gt;
(X) Ilitchev Fedor  filitche fedor dot ilitchev at gmail dot com &amp;lt;br&amp;gt; &lt;br /&gt;
(X) Panke   Shane   spanke&amp;lt;br&amp;gt;&lt;br /&gt;
(X) Shukla  Abhinav ashukla2&amp;lt;br&amp;gt;&lt;br /&gt;
(X) Wilson  Robert  jjpwilso&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_2_2010_Question_11&amp;diff=5929</id>
		<title>COMP 3000 Essay 2 2010 Question 11</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_2_2010_Question_11&amp;diff=5929"/>
		<updated>2010-12-01T15:09:47Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Virtualize Everything But Time =&lt;br /&gt;
Article written by Timothy Broomhead, Laurence Cremean, Julien Ridoux and Darrel Veitch. They are working for the Center for Ultra-Broadband Information Networks (CUBIN) Department of Electrical &amp;amp; Electronic Engineering at the University of Melbourne in Australia. Here is the link to the article: [http://www.usenix.org/events/osdi10/tech/full_papers/Broomhead.pdf]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Background Concepts=&lt;br /&gt;
&lt;br /&gt;
To better understand this paper, it is very important to have a good understanding of the general concepts breached in it. For example, we all know what clocks are in our day-to-day life but what are they in the context of computing? In this section, we will describe concepts like timekeeping, hardware/software clocks, the advantages and disadvantages of the different available counters, synchronization algorithms and explains what is a para-virtualized system.&lt;br /&gt;
&lt;br /&gt;
===Timekeeping===&lt;br /&gt;
&lt;br /&gt;
Since thousands of years, men have tried to find better ways to keep track of time. From sundials to atomic clocks, they were all made for the specific purpose of measuring the passage of time. This is not so different in computer operating systems. It is typically done in one of two ways: tick counting and tickless timekeeping[http://www.vmware.com/files/pdf/Timekeeping-In-VirtualMachines.pdf]. Tick counting is when the operating system sets up an hardware device, generally a CPU, to interrupt at a certain rate. So each time one of those interrupts are called(a tick), the operating system will keep track of it in a counter. That will tell the system how much time has passed. In tickless timekeeping, instead of the OS keeping track of time through interrupts, a hardware device is used instead starting its own counter when the system is booted. The OS just need to read the counter from it when needed. Tickless timekeeping seems to be the better way to keep track of time because it doesn’t hog the CPU with hardware interrupts however, its performance is very dependent on the type of hardware used. Another disadvantages is that they tend to drift and can cause inaccuracy. I will explains those drifts later. But both of these are just counters. They don’t know what is the actual real-time. To remedy that, either a computer gets its time from a battery-backed real-time clock or it queries a network time server(NTP) to get the current time. The computer can also use software in the form of a daemon that will run periodically to make adjustments to the time.&lt;br /&gt;
&lt;br /&gt;
===Clocks===&lt;br /&gt;
&lt;br /&gt;
Computer “clocks” or “timers” can be hardware based, software based or they can even be an hybrid. The most commonly found timer is the hardware timer. All of the hardware timers can be generally described by this diagram where some have either more or less features:&lt;br /&gt;
&lt;br /&gt;
Diagram1. Timer Abstraction&lt;br /&gt;
&lt;br /&gt;
[[File:Timerabstract.jpg]]&lt;br /&gt;
&lt;br /&gt;
This diagram nicely represent how tick counting works. The oscillator runs at a predetermine frequency. The operating system might have to mesure it when the system boots. The counter starts with a predetermined value which can be set by software. For every cycle of the oscillator, the counter counts down one unit. When it reaches zero, its generates an output signal that might interrupt the CPU. That same interrupt will then allow the counter’s initial value to be reloaded into the counter and the process begins again. As I said earlier, not all hardware timer works exactly like that. Some actually counts up, doesn&#039;t use interrupts or doesn&#039;t have an initial counter value but they still follow the same principle.&lt;br /&gt;
&lt;br /&gt;
===Timers===&lt;br /&gt;
# PIT is useful for generating interrupts at regular intervals through its three channels. Channel 0 is bound to IRQ0 which interrupts the CPU at regular intervals. Channel 1 is specific to each system and Channel 2 is connected to the speaker system. As such, we only need to concern ourselves with Channel 0. [http://www.osdever.net/bkerndev/Docs/pit.htm]&lt;br /&gt;
# CMOS RTC, also known as a CMOS battery, allows the CMOS chip to remain powered to keep track of things like time even while the physical PC unit has no source of power. If there is no CMOS battery on the motherboard, the computer would reset to its default time each restart. The battery itself can die, as expected, if the computer is powered off and not used for a long period of time. This can cause issues with the main OS as well as the VM. [http://kb.iu.edu/data/adoy.html]&lt;br /&gt;
# Local APIC handles all external interrupts for the processor in the system. It can also accept and generate inter-processor interrupts between Local APICs. [http://developer.intel.com/design/pentium/datashts/24201606.pdf]&lt;br /&gt;
# ACPI (I will fill these in later, Nov. 29th Update) --[[User:Spanke|Spanke]]&lt;br /&gt;
# TSC&lt;br /&gt;
# HPET&lt;br /&gt;
&lt;br /&gt;
==Guest Timekeeping==&lt;br /&gt;
&lt;br /&gt;
Guest timekeeping is done using the same general methods as any computer timekeeping, using either tick counting or tickless systems. Where the two begin to differ, however, is that a host operating system is able to communicate directly with the physical hardware, while the guest operating system is unable to do so, having to communicate with the host system that it wants to communicate with the hardware. Having to do this is the greatest source of the guest operating system&#039;s clock losing accuracy, or more simply called drifting.&lt;br /&gt;
&lt;br /&gt;
===Sources of Drift===&lt;br /&gt;
&lt;br /&gt;
When a guest operating system is started, its clock simply synchronizes with the host&#039;s – some virtual machines such as VMware also do this when it is resumed from a suspended state, or restored from a snapshot – so it is easy to think that, since it starts off correctly the guest&#039;s clock will continue to be correct. That is, of course, incorrect. The first source of drift is simply due to the drift a host incurs in its own timekeeping. A clock is almost never entirely accurate, having a slight error due to the time used to communicate with the counter, even on the host system, and because the guest communicates with the host in order to keep track of its time, an error in the host&#039;s time is not only passed on to the guest, but because the host is trying to correct its own time the guest&#039;s request for a count is given slightly less priority, making it yet again lose accuracy. The larger the drift in the host, the larger the drift in the guest, as the host&#039;s drift simply compounds the issue.&lt;br /&gt;
&lt;br /&gt;
Aside from the host&#039;s own drift, the other cause of drift in the virtual environment is the fact that the it is treated like a process by the host. In and of itself this doesn&#039;t seem like a problem, but because of it it can be denied the CPU time required, or allocated less memory than needed. With restricted CPU time, it&#039;s easy for the requested ticks or requested read of a counter to pile up and create a backlog of requests, or simply receive the requested data late enough to throw its clock off. With memory, if the virtual environment does not have enough allocated to it by the host it can run into the problem of swapping out pages that are needed soon. Swapping the pages back in will momentarily bring the entire virtual environment to a halt, so ticks are missed and the clock falls behind.&lt;br /&gt;
&lt;br /&gt;
===Impact of Drift===&lt;br /&gt;
&lt;br /&gt;
The impact of drift essentially boils down to round-off errors and lost ticks. The practical impact of drift, however, is quite apparent in any automated system. For a relatable real-world example, though not in a virtual environment, in a factory&#039;s assembly line, the machinery is finely tuned to do its own specific part at certain intervals, and it generally does so with impressive efficiency. If the clock in the system were to drift, however, a specific machine may move too soon or too late, bringing the line to a potentially catastrophic halt. In a virtual environment, drift is a bit more subtle, as one result of it could be skewed process scheduling – some schedulers give a certain amount of time to a process before moving on, but if the guest&#039;s time has drifted substantially, when it tries to correct its time it could give more or less time to the processes in the scheduler.&lt;br /&gt;
&lt;br /&gt;
===Compensation Strategies===&lt;br /&gt;
&lt;br /&gt;
There are a number of compensation strategies for dealing with drift, depending on the cause of it. If the problem is due to CPU management issues, then the host can give more CPU time to the virtual machine, or it can lower the timer interrupt rate – or simply use a tickless counter. If it is due to a  memory management issue, allocating more memory to the virtual environment should prevent the system from needing to swap out page files so often.&lt;br /&gt;
&lt;br /&gt;
If the issue is from neither of those, but simply due to the inevitable lag when the guest communicates with the hardware via the host, then there are other methods to correct the drift. Most systems natively have algorithms built in to correct the time if it gets too far ahead or behind real time, though they are not without their own faults; if the time is set ahead when catching up, the backlog of ticks it has built up may not be cleared, so it could potentially set itself ahead multiple times until the backlog is dealt with. Tools built into the virtual machine itself can also deal with drift to an extent, as VMware Tools does. This kind of tool checks to see if the clock&#039;s error is within a certain margin. If it exceeds the margin, then the backlog is set to zero – to prevent the issue mentioned with the native algorithms – and resynchronizes with the host clock before the guest goes back to keeping track of time as it normally would.&lt;br /&gt;
&lt;br /&gt;
=Research problem=&lt;br /&gt;
=Contribution=&lt;br /&gt;
=Critique=&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. Virtualize Everything But Time by Timothy Broomhead, Laurence Cremean, Julien Ridoux and Darrel Veitch, 2010. http://www.usenix.org/events/osdi10/tech/full_papers/Broomhead.pdf&lt;br /&gt;
&lt;br /&gt;
2. Timekeeping in Virtual Machines, Information Guide from VMWare. http://www.vmware.com/files/pdf/Timekeeping-In-VirtualMachines.pdf&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_2_2010_Question_11&amp;diff=5928</id>
		<title>COMP 3000 Essay 2 2010 Question 11</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_2_2010_Question_11&amp;diff=5928"/>
		<updated>2010-12-01T15:03:47Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Virtualize Everything But Time =&lt;br /&gt;
Article written by Timothy Broomhead, Laurence Cremean, Julien Ridoux and Darrel Veitch. They are working for the Center for Ultra-Broadband Information Networks (CUBIN) Department of Electrical &amp;amp; Electronic Engineering at the University of Melbourne in Australia. Here is the link to the article: [http://www.usenix.org/events/osdi10/tech/full_papers/Broomhead.pdf]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Background Concepts=&lt;br /&gt;
&lt;br /&gt;
To better understand this paper, it is very important to have a good understanding of the general concepts breached in it. For example, we all know what clocks are in our day-to-day life but what are they in the context of computing? In this section, we will describe concepts like timekeeping, hardware/software clocks, the advantages and disadvantages of the different available counters, synchronization algorithms and explains what is a para-virtualized system.&lt;br /&gt;
&lt;br /&gt;
===Timekeeping===&lt;br /&gt;
&lt;br /&gt;
Since thousands of years, men have tried to find better ways to keep track of time. From sundials to atomic clocks, they were all made for the specific purpose of measuring the passage of time. This is not so different in computer operating systems. It is typically done in one of two ways: tick counting and tickless timekeeping[http://www.vmware.com/files/pdf/Timekeeping-In-VirtualMachines.pdf]. Tick counting is when the operating system sets up an hardware device, generally a CPU, to interrupt at a certain rate. So each time one of those interrupts are called(a tick), the operating system will keep track of it in a counter. That will tell the system how much time has passed. In tickless timekeeping, instead of the OS keeping track of time through interrupts, a hardware device is used instead starting its own counter when the system is booted. The OS just need to read the counter from it when needed. Tickless timekeeping seems to be the better way to keep track of time because it doesn’t hog the CPU with hardware interrupts however, its performance is very dependent on the type of hardware used. Another disadvantages is that they tend to drift and can cause inaccuracy. I will explains those drifts later. But both of these are just counters. They don’t know what is the actual real-time. To remedy that, either a computer gets its time from a battery-backed real-time clock or it queries a network time server(NTP) to get the current time. The computer can also use software in the form of a daemon that will run periodically to make adjustments to the time.&lt;br /&gt;
&lt;br /&gt;
===Clocks===&lt;br /&gt;
&lt;br /&gt;
Computer “clocks” or “timers” can be hardware based, software based or they can even be an hybrid. The most commonly found timer is the hardware timer. All of the hardware timers can be generally described by this diagram where some have either more or less features:&lt;br /&gt;
&lt;br /&gt;
Diagram1. Timer Abstraction&lt;br /&gt;
&lt;br /&gt;
[[File:Timerabstract.jpg]]&lt;br /&gt;
&lt;br /&gt;
This diagram nicely represent how tick counting works[2]. The oscillator runs at a predetermine frequency. The operating system might have to mesure it when the system boots. The counter starts with a predetermined value which can be set by software. For every cycle of the oscillator, the counter counts down one unit. When it reaches zero, its generates an output signal that might interrupt the CPU. That same interrupt will then allow the counter’s initial value to be reloaded into the counter and the process begins again. As I said earlier, not all hardware timer works exactly like that. Some actually counts up, doesn&#039;t use interrupts or doesn&#039;t have an initial counter value but they still follow the same principle.&lt;br /&gt;
&lt;br /&gt;
===Timers===&lt;br /&gt;
# PIT is useful for generating interrupts at regular intervals through its three channels. Channel 0 is bound to IRQ0 which interrupts the CPU at regular intervals. Channel 1 is specific to each system and Channel 2 is connected to the speaker system. As such, we only need to concern ourselves with Channel 0. [http://www.osdever.net/bkerndev/Docs/pit.htm]&lt;br /&gt;
# CMOS RTC, also known as a CMOS battery, allows the CMOS chip to remain powered to keep track of things like time even while the physical PC unit has no source of power. If there is no CMOS battery on the motherboard, the computer would reset to its default time each restart. The battery itself can die, as expected, if the computer is powered off and not used for a long period of time. This can cause issues with the main OS as well as the VM. [http://kb.iu.edu/data/adoy.html]&lt;br /&gt;
# Local APIC handles all external interrupts for the processor in the system. It can also accept and generate inter-processor interrupts between Local APICs. [http://developer.intel.com/design/pentium/datashts/24201606.pdf]&lt;br /&gt;
# ACPI (I will fill these in later, Nov. 29th Update) --[[User:Spanke|Spanke]]&lt;br /&gt;
# TSC&lt;br /&gt;
# HPET&lt;br /&gt;
&lt;br /&gt;
==Guest Timekeeping==&lt;br /&gt;
&lt;br /&gt;
Guest timekeeping is done using the same general methods as any computer timekeeping, using either tick counting or tickless systems. Where the two begin to differ, however, is that a host operating system is able to communicate directly with the physical hardware, while the guest operating system is unable to do so, having to communicate with the host system that it wants to communicate with the hardware. Having to do this is the greatest source of the guest operating system&#039;s clock losing accuracy, or more simply called drifting.&lt;br /&gt;
&lt;br /&gt;
===Sources of Drift===&lt;br /&gt;
&lt;br /&gt;
When a guest operating system is started, its clock simply synchronizes with the host&#039;s – some virtual machines such as VMware also do this when it is resumed from a suspended state, or restored from a snapshot – so it is easy to think that, since it starts off correctly the guest&#039;s clock will continue to be correct. That is, of course, incorrect. The first source of drift is simply due to the drift a host incurs in its own timekeeping. A clock is almost never entirely accurate, having a slight error due to the time used to communicate with the counter, even on the host system, and because the guest communicates with the host in order to keep track of its time, an error in the host&#039;s time is not only passed on to the guest, but because the host is trying to correct its own time the guest&#039;s request for a count is given slightly less priority, making it yet again lose accuracy. The larger the drift in the host, the larger the drift in the guest, as the host&#039;s drift simply compounds the issue.&lt;br /&gt;
&lt;br /&gt;
Aside from the host&#039;s own drift, the other cause of drift in the virtual environment is the fact that the it is treated like a process by the host. In and of itself this doesn&#039;t seem like a problem, but because of it it can be denied the CPU time required, or allocated less memory than needed. With restricted CPU time, it&#039;s easy for the requested ticks or requested read of a counter to pile up and create a backlog of requests, or simply receive the requested data late enough to throw its clock off. With memory, if the virtual environment does not have enough allocated to it by the host it can run into the problem of swapping out pages that are needed soon. Swapping the pages back in will momentarily bring the entire virtual environment to a halt, so ticks are missed and the clock falls behind.&lt;br /&gt;
&lt;br /&gt;
===Impact of Drift===&lt;br /&gt;
&lt;br /&gt;
The impact of drift essentially boils down to round-off errors and lost ticks. The practical impact of drift, however, is quite apparent in any automated system. For a relatable real-world example, though not in a virtual environment, in a factory&#039;s assembly line, the machinery is finely tuned to do its own specific part at certain intervals, and it generally does so with impressive efficiency. If the clock in the system were to drift, however, a specific machine may move too soon or too late, bringing the line to a potentially catastrophic halt. In a virtual environment, drift is a bit more subtle, as one result of it could be skewed process scheduling – some schedulers give a certain amount of time to a process before moving on, but if the guest&#039;s time has drifted substantially, when it tries to correct its time it could give more or less time to the processes in the scheduler.&lt;br /&gt;
&lt;br /&gt;
===Compensation Strategies===&lt;br /&gt;
&lt;br /&gt;
There are a number of compensation strategies for dealing with drift, depending on the cause of it. If the problem is due to CPU management issues, then the host can give more CPU time to the virtual machine, or it can lower the timer interrupt rate – or simply use a tickless counter. If it is due to a  memory management issue, allocating more memory to the virtual environment should prevent the system from needing to swap out page files so often.&lt;br /&gt;
&lt;br /&gt;
If the issue is from neither of those, but simply due to the inevitable lag when the guest communicates with the hardware via the host, then there are other methods to correct the drift. Most systems natively have algorithms built in to correct the time if it gets too far ahead or behind real time, though they are not without their own faults; if the time is set ahead when catching up, the backlog of ticks it has built up may not be cleared, so it could potentially set itself ahead multiple times until the backlog is dealt with. Tools built into the virtual machine itself can also deal with drift to an extent, as VMware Tools does. This kind of tool checks to see if the clock&#039;s error is within a certain margin. If it exceeds the margin, then the backlog is set to zero – to prevent the issue mentioned with the native algorithms – and resynchronizes with the host clock before the guest goes back to keeping track of time as it normally would.&lt;br /&gt;
&lt;br /&gt;
=Research problem=&lt;br /&gt;
=Contribution=&lt;br /&gt;
=Critique=&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. Virtualize Everything But Time by Timothy Broomhead, Laurence Cremean, Julien Ridoux and Darrel Veitch, 2010. http://www.usenix.org/events/osdi10/tech/full_papers/Broomhead.pdf&lt;br /&gt;
&lt;br /&gt;
2. Timekeeping in Virtual Machines, Information Guide from VMWare. http://www.vmware.com/files/pdf/Timekeeping-In-VirtualMachines.pdf&lt;br /&gt;
&lt;br /&gt;
3. Modern Operating System 3rd Edition, by Andrew S. Tanenbaum, published by Pearson.&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_2_2010_Question_11&amp;diff=5925</id>
		<title>COMP 3000 Essay 2 2010 Question 11</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_2_2010_Question_11&amp;diff=5925"/>
		<updated>2010-12-01T14:48:07Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Virtualize Everything But Time =&lt;br /&gt;
Article written by Timothy Broomhead, Laurence Cremean, Julien Ridoux and Darrel Veitch. They are working for the Center for Ultra-Broadband Information Networks (CUBIN) Department of Electrical &amp;amp; Electronic Engineering at the University of Melbourne in Australia. Here is the link to the article: [http://www.usenix.org/events/osdi10/tech/full_papers/Broomhead.pdf]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Background Concepts=&lt;br /&gt;
&lt;br /&gt;
To better understand this paper, it is very important to have a good understanding of the general concepts breached in it. For example, we all know what clocks are in our day-to-day life but what are they in the context of computing? In this section, we will describe concepts like timekeeping, hardware/software clocks, the advantages and disadvantages of the different available counters, synchronization algorithms and explains what is a para-virtualized system.&lt;br /&gt;
&lt;br /&gt;
===Timekeeping===&lt;br /&gt;
&lt;br /&gt;
Since thousands of years, men have tried to find better ways to keep track of time. From sundials to atomic clocks, they were all made for the specific purpose of measuring the passage of time. This is not so different in computer operating systems. It is typically done in one of two ways: tick counting and tickless timekeeping[http://www.vmware.com/files/pdf/Timekeeping-In-VirtualMachines.pdf]. Tick counting is when the operating system sets up an hardware device, generally a CPU, to interrupt at a certain rate. So each time one of those interrupts are called(a tick), the operating system will keep track of it in a counter. That will tell the system how much time has passed. In tickless timekeeping, instead of the OS keeping track of time through interrupts, a hardware device is used instead starting its own counter when the system is booted. The OS just need to read the counter from it when needed. Tickless timekeeping seems to be the better way to keep track of time because it doesn’t hog the CPU with hardware interrupts however, its performance is very dependent on the type of hardware used. Another disadvantages is that they tend to drift and can cause inaccuracy. I will explains those drifts later. But both of these are just counters. They don’t know what is the actual real-time. To remedy that, either a computer gets its time from a battery-backed real-time clock or it queries a network time server(NTP) to get the current time. The computer can also use software in the form of a daemon that will run periodically to make adjustments to the time.&lt;br /&gt;
&lt;br /&gt;
===Clocks===&lt;br /&gt;
&lt;br /&gt;
Computer “clocks” or “timers” can be hardware based, software based or they can even be an hybrid. The most commonly found timer is the hardware timer. All of the hardware timers can be generally described by this diagram where some have either more or less features:&lt;br /&gt;
&lt;br /&gt;
Diagram1. Timer Abstraction&lt;br /&gt;
&lt;br /&gt;
[[File:Timerabstract.jpg]]&lt;br /&gt;
&lt;br /&gt;
This diagram nicely represent how tick counting works[2]. The oscillator runs at a predetermine frequency. The operating system might have to mesure it when the system boots. The counter starts with a predetermined value which can be set by software. For every cycle of the oscillator, the counter counts down one unit. When it reaches zero, its generates an output signal that might interrupt the CPU. That same interrupt will then allow the counter’s initial value to be reloaded into the counter and the process begins again. As I said earlier, not all hardware timer works exactly like that. Some actually counts up, doesn&#039;t use interrupts or doesn&#039;t have an initial counter value but they still follow the same principle.&lt;br /&gt;
&lt;br /&gt;
===Timers===&lt;br /&gt;
# PIT is useful for generating interrupts at regular intervals through its three channels. Channel 0 is bound to IRQ0 which interrupts the CPU at regular intervals. Channel 1 is specific to each system and Channel 2 is connected to the speaker system. As such, we only need to concern ourselves with Channel 0. [http://www.osdever.net/bkerndev/Docs/pit.htm]&lt;br /&gt;
# CMOS RTC, also known as a CMOS battery, allows the CMOS chip to remain powered to keep track of things like time even while the physical PC unit has no source of power. If there is no CMOS battery on the motherboard, the computer would reset to its default time each restart. The battery itself can die, as expected, if the computer is powered off and not used for a long period of time. This can cause issues with the main OS as well as the VM. [http://kb.iu.edu/data/adoy.html]&lt;br /&gt;
# Local APIC handles all external interrupts for the processor in the system. It can also accept and generate inter-processor interrupts between Local APICs. [http://developer.intel.com/design/pentium/datashts/24201606.pdf]&lt;br /&gt;
# ACPI (I will fill these in later, Nov. 29th Update) --[[User:Spanke|Spanke]]&lt;br /&gt;
# TSC&lt;br /&gt;
# HPET&lt;br /&gt;
&lt;br /&gt;
==Guest Timekeeping==&lt;br /&gt;
&lt;br /&gt;
Guest timekeeping is done using the same general methods as any computer timekeeping, using either tick counting or tickless systems. Where the two begin to differ, however, is that a host operating system is able to communicate directly with the physical hardware, while the guest operating system is unable to do so, having to communicate with the host system that it wants to communicate with the hardware. Having to do this is the greatest source of the guest operating system&#039;s clock losing accuracy, or more simply called drifting.&lt;br /&gt;
&lt;br /&gt;
===Sources of Drift===&lt;br /&gt;
&lt;br /&gt;
When a guest operating system is started, its clock simply synchronizes with the host&#039;s – some virtual machines such as VMware also do this when it is resumed from a suspended state, or restored from a snapshot – so it is easy to think that, since it starts off correctly the guest&#039;s clock will continue to be correct. That is, of course, incorrect. The first source of drift is simply due to the drift a host incurs in its own timekeeping. A clock is almost never entirely accurate, having a slight error due to the time used to communicate with the counter, even on the host system, and because the guest communicates with the host in order to keep track of its time, an error in the host&#039;s time is not only passed on to the guest, but because the host is trying to correct its own time the guest&#039;s request for a count is given slightly less priority, making it yet again lose accuracy. The larger the drift in the host, the larger the drift in the guest, as the host&#039;s drift simply compounds the issue.&lt;br /&gt;
&lt;br /&gt;
Aside from the host&#039;s own drift, the other cause of drift in the virtual environment is the fact that the it is treated like a process by the host. In and of itself this doesn&#039;t seem like a problem, but because of it it can be denied the CPU time required, or allocated less memory than needed. With restricted CPU time, it&#039;s easy for the requested ticks or requested read of a counter to pile up and create a backlog of requests, or simply receive the requested data late enough to throw its clock off. With memory, if the virtual environment does not have enough allocated to it by the host it can run into the problem of swapping out pages that are needed soon. Swapping the pages back in will momentarily bring the entire virtual environment to a halt, so ticks are missed and the clock falls behind.&lt;br /&gt;
&lt;br /&gt;
===Impact of Drift===&lt;br /&gt;
&lt;br /&gt;
The impact of drift essentially boils down to round-off errors and lost ticks. The practical impact of drift, however, is quite apparent in any automated system. For a relatable real-world example, though not in a virtual environment, in a factory&#039;s assembly line, the machinery is finely tuned to do its own specific part at certain intervals, and it generally does so with impressive efficiency. If the clock in the system were to drift, however, a specific machine may move too soon or too late, bringing the line to a potentially catastrophic halt. In a virtual environment, drift is a bit more subtle, as one result of it could be skewed process scheduling – some schedulers give a certain amount of time to a process before moving on, but if the guest&#039;s time has drifted substantially, when it tries to correct its time it could give more or less time to the processes in the scheduler.&lt;br /&gt;
&lt;br /&gt;
===Compensation Strategies===&lt;br /&gt;
&lt;br /&gt;
There are a number of compensation strategies for dealing with drift, depending on the cause of it. If the problem is due to CPU management issues, then the host can give more CPU time to the virtual machine, or it can lower the timer interrupt rate – or simply use a tickless counter. If it is due to a  memory management issue, allocating more memory to the virtual environment should prevent the system from needing to swap out page files so often.&lt;br /&gt;
&lt;br /&gt;
If the issue is from neither of those, but simply due to the inevitable lag when the guest communicates with the hardware via the host, then there are other methods to correct the drift. Most systems natively have algorithms built in to correct the time if it gets too far ahead or behind real time, though they are not without their own faults; if the time is set ahead when catching up, the backlog of ticks it has built up may not be cleared, so it could potentially set itself ahead multiple times until the backlog is dealt with. Tools built into the virtual machine itself can also deal with drift to an extent, as VMware Tools does. This kind of tool checks to see if the clock&#039;s error is within a certain margin. If it exceeds the margin, then the backlog is set to zero – to prevent the issue mentioned with the native algorithms – and resynchronizes with the host clock before the guest goes back to keeping track of time as it normally would.&lt;br /&gt;
&lt;br /&gt;
=Research problem=&lt;br /&gt;
=Contribution=&lt;br /&gt;
=Critique=&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. Timekeeping in Virtual Machines, Information Guide from VMWare. http://www.vmware.com/files/pdf/Timekeeping-In-VirtualMachines.pdf&lt;br /&gt;
&lt;br /&gt;
2. Modern Operating System 3rd Edition, by Andrew S. Tanenbaum, published by Pearson.&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_2_2010_Question_11&amp;diff=5462</id>
		<title>COMP 3000 Essay 2 2010 Question 11</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_2_2010_Question_11&amp;diff=5462"/>
		<updated>2010-11-23T11:40:22Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Background Concepts=&lt;br /&gt;
&lt;br /&gt;
To better understand this paper, it is very important to have a good understanding of the general concepts breached in it. For example, we all know what clocks are in our day-to-day life but what are they in the context of computing? In this section, we will describe concepts like timekeeping, hardware/software clocks, the advantages and disadvantages of the different available counters, synchronization algorithms and explains what is a para-virtualized system.&lt;br /&gt;
&lt;br /&gt;
===Timekeeping===&lt;br /&gt;
&lt;br /&gt;
Since thousands of years, men have tried to find better ways to keep track of time. From sundials to atomic clocks, they were all made for the specific purpose of measuring the passage of time. This is not so different in computer operating systems. It is typically done in one of two ways: tick counting and tickless timekeeping[1]. Tick counting is when the operating system sets up an hardware device, generally a CPU, to interrupt at a certain rate. So each time one of those interrupts are called(a tick), the operating system will keep track of it in a counter. That will tell the system how much time has passed. In tickless timekeeping, instead of the OS keeping track of time through interrupts, a hardware device is used instead starting its own counter when the system is booted. The OS just need to read the counter from it when needed. Tickless timekeeping seems to be the better way to keep track of time because it doesn’t hog the CPU with hardware interrupts however, its performance is very dependent on the type of hardware used. Another disadvantages is that they tend to drift and can cause inaccuracy. I will explains those drifts later. But both of these are just counters. They don’t know what is the actual real-time. To remedy that, either a computer gets its time from a battery-backed real-time clock or it queries a network time server(NTP) to get the current time. The computer can also use software in the form of a daemon that will run periodically to make adjustments to the time.&lt;br /&gt;
&lt;br /&gt;
===Clocks===&lt;br /&gt;
&lt;br /&gt;
Computer “clocks” or “timers” can be hardware based, software based or they can even be an hybrid. The most commonly found timer is the hardware timer. All of the hardware timers can be generally described by this diagram where some have either more or less features:&lt;br /&gt;
&lt;br /&gt;
Diagram1. Timer Abstraction&lt;br /&gt;
&lt;br /&gt;
[[File:Timerabstract.jpg]]&lt;br /&gt;
&lt;br /&gt;
This diagram nicely represent how tick counting works[2]. The oscillator runs at a predetermine frequency. The operating system might have to mesure it when the system boots. The counter starts with a predetermined value which can be set by software. For every cycle of the oscillator, the counter counts down one unit. When it reaches zero, its generates an output signal that might interrupt the CPU. That same interrupt will then allow the counter’s initial value to be reloaded into the counter and the process begins again. As I said earlier, not all hardware timer works exactly like that. Some actually counts up, doesn&#039;t use interrupts or doesn&#039;t have an initial counter value but they still follow the same principle.&lt;br /&gt;
&lt;br /&gt;
===Timers===&lt;br /&gt;
# PIT is useful for generating interrupts at regular intervals through its three channels. Channel 0 is bound to IRQ0 which interrupts the CPU at regular intervals. Channel 1 is specific to each system and Channel 2 is connected to the speaker system. As such, we only need to concern ourselves with Channel 0. [http://www.osdever.net/bkerndev/Docs/pit.htm]&lt;br /&gt;
# CMOS RTC (I will fill these in later) --[[User:Spanke|Spanke]]&lt;br /&gt;
# Local APIC&lt;br /&gt;
# ACPI&lt;br /&gt;
# TSC&lt;br /&gt;
# HPET&lt;br /&gt;
&lt;br /&gt;
==Guest Timekeeping==&lt;br /&gt;
This section will explain why timing is different for guest operating systems.&lt;br /&gt;
===Sources of Drift===&lt;br /&gt;
Discuss what causes the problem in virtual environments. Consider para-virtual and full-virtual architectures.&lt;br /&gt;
===Impact of Drift===&lt;br /&gt;
Discuss the impact of error on a few real-world applications.&lt;br /&gt;
===Compensation Strategies===&lt;br /&gt;
Discuss common strategies in VM software and in operating systems to compensate for drift. Discuss what happens when the clock is slow and fast.&lt;br /&gt;
&lt;br /&gt;
=Research problem=&lt;br /&gt;
=Contribution=&lt;br /&gt;
=Critique=&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. Timekeeping in Virtual Machines, Information Guide from VMWare. http://www.vmware.com/files/pdf/Timekeeping-In-VirtualMachines.pdf&lt;br /&gt;
&lt;br /&gt;
2. Modern Operating System 3rd Edition, by Andrew S. Tanenbaum, published by Pearson.&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_2_2010_Question_11&amp;diff=5461</id>
		<title>COMP 3000 Essay 2 2010 Question 11</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_2_2010_Question_11&amp;diff=5461"/>
		<updated>2010-11-23T11:37:15Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Background Concepts=&lt;br /&gt;
&lt;br /&gt;
To better understand this paper, it is very important to have a good understanding of the general concepts breached in it. For example, we all know what clocks are in our day-to-day life but what are they in the context of computing? In this section, we will describe concepts like timekeeping, hardware/software clocks, the advantages and disadvantages of the different available counters, synchronization algorithms and explains what is a para-virtualized system.&lt;br /&gt;
&lt;br /&gt;
===Timekeeping===&lt;br /&gt;
&lt;br /&gt;
Since thousands of years, men have tried to find better ways to keep track of time. From sundials to atomic clocks, they were all made for the specific purpose of measuring the passage of time. This is not so different in computer operating systems. It is typically done in one of two ways: tick counting and tickless timekeeping[1]. Tick counting is when the operating system sets up an hardware device, generally a CPU, to interrupt at a certain rate. So each time one of those interrupts are called(a tick), the operating system will keep track of it in a counter. That will tell the system how much time has passed. In tickless timekeeping, instead of the OS keeping track of time through interrupts, a hardware device is used instead starting its own counter when the system is booted. The OS just need to read the counter from it when needed. Tickless timekeeping seems to be the better way to keep track of time because it doesn’t hog the CPU with hardware interrupts however, its performance is very dependent on the type of hardware used. Another disadvantages is that they tend to drift and can cause inaccuracy. I will explains those drifts later. But both of these are just counters. They don’t know what is the actual real-time. To remedy that, either a computer gets its time from a battery-backed real-time clock or it queries a network time server(NTP) to get the current time. The computer can also use software in the form of a daemon that will run periodically to make adjustments to the time.&lt;br /&gt;
&lt;br /&gt;
===Clocks===&lt;br /&gt;
&lt;br /&gt;
Computer “clocks” or “timers” can be hardware based, software based or they can even be an hybrid. The most commonly found timer is the hardware timer. All of the hardware timers can be generally described by this diagram where some have either more or less features:&lt;br /&gt;
&lt;br /&gt;
Diagram1. Timer Abstraction&lt;br /&gt;
&lt;br /&gt;
[[File:Timerabstract.jpg]]&lt;br /&gt;
&lt;br /&gt;
This diagram nicely represent how tick counting works[2]. The oscillator runs at a predetermine frequency. The operating system might have to mesure it when the system boots. The counter starts with a predetermined value which can be set by software. For every cycle of the oscillator, the counter counts down one unit. When it reaches zero, its generates an output signal that might interrupt the CPU. That same interrupt will then allow the counter’s initial value to be reloaded into the counter and the process begins again.&lt;br /&gt;
&lt;br /&gt;
===Timers===&lt;br /&gt;
# PIT is useful for generating interrupts at regular intervals through its three channels. Channel 0 is bound to IRQ0 which interrupts the CPU at regular intervals. Channel 1 is specific to each system and Channel 2 is connected to the speaker system. As such, we only need to concern ourselves with Channel 0. [http://www.osdever.net/bkerndev/Docs/pit.htm]&lt;br /&gt;
# CMOS RTC (I will fill these in later) --[[User:Spanke|Spanke]]&lt;br /&gt;
# Local APIC&lt;br /&gt;
# ACPI&lt;br /&gt;
# TSC&lt;br /&gt;
# HPET&lt;br /&gt;
&lt;br /&gt;
==Guest Timekeeping==&lt;br /&gt;
This section will explain why timing is different for guest operating systems.&lt;br /&gt;
===Sources of Drift===&lt;br /&gt;
Discuss what causes the problem in virtual environments. Consider para-virtual and full-virtual architectures.&lt;br /&gt;
===Impact of Drift===&lt;br /&gt;
Discuss the impact of error on a few real-world applications.&lt;br /&gt;
===Compensation Strategies===&lt;br /&gt;
Discuss common strategies in VM software and in operating systems to compensate for drift. Discuss what happens when the clock is slow and fast.&lt;br /&gt;
&lt;br /&gt;
=Research problem=&lt;br /&gt;
=Contribution=&lt;br /&gt;
=Critique=&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. Timekeeping in Virtual Machines, Information Guide from VMWare. http://www.vmware.com/files/pdf/Timekeeping-In-VirtualMachines.pdf&lt;br /&gt;
&lt;br /&gt;
2. Modern Operating System 3rd Edition, by Andrew S. Tanenbaum, published by Pearson.&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_2_2010_Question_11&amp;diff=5399</id>
		<title>COMP 3000 Essay 2 2010 Question 11</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_2_2010_Question_11&amp;diff=5399"/>
		<updated>2010-11-22T22:15:36Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Background Concepts=&lt;br /&gt;
&lt;br /&gt;
To better understand this paper, it is very important to have a good understanding of the general concepts breached in it. For example, we all know what clocks are in our day-to-day life but what are they in the context of computing? In this section, we will describe concepts like timekeeping, hardware/software clocks, the advantages and disadvantages of the different available counters, synchronization algorithms and explains what is a para-virtualized system.&lt;br /&gt;
&lt;br /&gt;
===Timekeeping===&lt;br /&gt;
&lt;br /&gt;
Since thousands of years, men have tried to find better ways to keep track of time. From sundials to atomic clocks, they were all made for the specific purpose of measuring the passage of time. This is not so different in computer operating systems. It is typically done in one of two ways: tick counting and tickless timekeeping[1]. Tick counting is when the operating system sets up an hardware device, generally a CPU, to interrupt at a certain rate. So each time one of those interrupts are called(a tick), the operating system will keep track of it in a counter. That will tell the system how much time has passed. In tickless timekeeping, instead of the OS keeping track of time through interrupts, a hardware device is used instead starting its own counter when the system is booted. The OS just need to read the counter from it when needed. Tickless timekeeping seems to be the better way to keep track of time because it doesn’t hog the CPU with hardware interrupts however, its performance is very dependent on the type of hardware used. Another disadvantages is that they tend to drift and can cause inaccuracy. I will explains those drifts later. But both of these are just counters. They don’t know what is the actual real-time. To remedy that, either a computer gets its time from a battery-backed real-time clock or it queries a network time server(NTP) to get the current time. The computer can also use software in the form of a daemon that will run periodically to make adjustments to the time.&lt;br /&gt;
&lt;br /&gt;
===Clocks===&lt;br /&gt;
&lt;br /&gt;
Computer “clocks” or “timers” can be hardware based, software based or they can even be an hybrid. The most commonly found timer is the hardware timer. All of the hardware timers can be generally described by this diagram where some have either more or less features:&lt;br /&gt;
&lt;br /&gt;
Diagram1. Timer Abstraction&lt;br /&gt;
&lt;br /&gt;
[[File:Timerabstract.jpg]]&lt;br /&gt;
&lt;br /&gt;
This diagram nicely represent how tick counting works[2]. The oscillator runs at a predetermine frequency. The operating system might have to mesure it when the system boots. The counter starts with a predetermined value which can be set by software. For every cycle of the oscillator, the counter counts down one unit. When it reaches zero, its generates an output signal that might interrupt the CPU. That same interrupt will then allow the counter’s initial value to be reloaded into the counter and the process begins again.&lt;br /&gt;
&lt;br /&gt;
===Timers===&lt;br /&gt;
# PIT&lt;br /&gt;
# CMOS RTC&lt;br /&gt;
# Local APIC&lt;br /&gt;
# ACPI&lt;br /&gt;
# TSC&lt;br /&gt;
# HPET&lt;br /&gt;
&lt;br /&gt;
==Guest Timekeeping==&lt;br /&gt;
This section will explain why timing is different for guest operating systems.&lt;br /&gt;
===Sources of Drift===&lt;br /&gt;
Discuss what causes the problem in virtual environments. Consider para-virtual and full-virtual architectures.&lt;br /&gt;
===Impact of Drift===&lt;br /&gt;
Discuss the impact of error on a few real-world applications.&lt;br /&gt;
===Compensation Strategies===&lt;br /&gt;
Discuss common strategies in VM software and in operating systems to compensate for drift. Discuss what happens when the clock is slow and fast.&lt;br /&gt;
&lt;br /&gt;
=Research problem=&lt;br /&gt;
=Contribution=&lt;br /&gt;
=Critique=&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. Timekeeping in Virtual Machines, Information Guide from VMWare. http://www.vmware.com/files/pdf/Timekeeping-In-VirtualMachines.pdf&lt;br /&gt;
2. Modern Operating System 3rd Edition, by Andrew S. Tanenbaum, published by Pearson.&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_2_2010_Question_11&amp;diff=5398</id>
		<title>COMP 3000 Essay 2 2010 Question 11</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_2_2010_Question_11&amp;diff=5398"/>
		<updated>2010-11-22T22:14:57Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Example.jpg]]=Background Concepts=&lt;br /&gt;
&lt;br /&gt;
To better understand this paper, it is very important to have a good understanding of the general concepts breached in it. For example, we all know what clocks are in our day-to-day life but what are they in the context of computing? In this section, we will describe concepts like timekeeping, hardware/software clocks, the advantages and disadvantages of the different available counters, synchronization algorithms and explains what is a para-virtualized system.&lt;br /&gt;
&lt;br /&gt;
===Timekeeping===&lt;br /&gt;
&lt;br /&gt;
Since thousands of years, men have tried to find better ways to keep track of time. From sundials to atomic clocks, they were all made for the specific purpose of measuring the passage of time. This is not so different in computer operating systems. It is typically done in one of two ways: tick counting and tickless timekeeping[1]. Tick counting is when the operating system sets up an hardware device, generally a CPU, to interrupt at a certain rate. So each time one of those interrupts are called(a tick), the operating system will keep track of it in a counter. That will tell the system how much time has passed. In tickless timekeeping, instead of the OS keeping track of time through interrupts, a hardware device is used instead starting its own counter when the system is booted. The OS just need to read the counter from it when needed. Tickless timekeeping seems to be the better way to keep track of time because it doesn’t hog the CPU with hardware interrupts however, its performance is very dependent on the type of hardware used. Another disadvantages is that they tend to drift and can cause inaccuracy. I will explains those drifts later. But both of these are just counters. They don’t know what is the actual real-time. To remedy that, either a computer gets its time from a battery-backed real-time clock or it queries a network time server(NTP) to get the current time. The computer can also use software in the form of a daemon that will run periodically to make adjustments to the time.&lt;br /&gt;
&lt;br /&gt;
===Clocks===&lt;br /&gt;
&lt;br /&gt;
Computer “clocks” or “timers” can be hardware based, software based or they can even be an hybrid. The most commonly found timer is the hardware timer. All of the hardware timers can be generally described by this diagram where some have either more or less features:&lt;br /&gt;
&lt;br /&gt;
Diagram1. Timer Abstraction&lt;br /&gt;
&lt;br /&gt;
[[File:Timerabstract.jpg]]&lt;br /&gt;
&lt;br /&gt;
This diagram nicely represent how tick counting works[2]. The oscillator runs at a predetermine frequency. The operating system might have to mesure it when the system boots. The counter starts with a predetermined value which can be set by software. For every cycle of the oscillator, the counter counts down one unit. When it reaches zero, its generates an output signal that might interrupt the CPU. That same interrupt will then allow the counter’s initial value to be reloaded into the counter and the process begins again.&lt;br /&gt;
&lt;br /&gt;
===Timers===&lt;br /&gt;
# PIT&lt;br /&gt;
# CMOS RTC&lt;br /&gt;
# Local APIC&lt;br /&gt;
# ACPI&lt;br /&gt;
# TSC&lt;br /&gt;
# HPET&lt;br /&gt;
&lt;br /&gt;
==Guest Timekeeping==&lt;br /&gt;
This section will explain why timing is different for guest operating systems.&lt;br /&gt;
===Sources of Drift===&lt;br /&gt;
Discuss what causes the problem in virtual environments. Consider para-virtual and full-virtual architectures.&lt;br /&gt;
===Impact of Drift===&lt;br /&gt;
Discuss the impact of error on a few real-world applications.&lt;br /&gt;
===Compensation Strategies===&lt;br /&gt;
Discuss common strategies in VM software and in operating systems to compensate for drift. Discuss what happens when the clock is slow and fast.&lt;br /&gt;
&lt;br /&gt;
=Research problem=&lt;br /&gt;
=Contribution=&lt;br /&gt;
=Critique=&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. Timekeeping in Virtual Machines, Information Guide from VMWare. http://www.vmware.com/files/pdf/Timekeeping-In-VirtualMachines.pdf&lt;br /&gt;
2. Modern Operating System 3rd Edition, by Andrew S. Tanenbaum, published by Pearson.&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_2_2010_Question_11&amp;diff=5396</id>
		<title>COMP 3000 Essay 2 2010 Question 11</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_2_2010_Question_11&amp;diff=5396"/>
		<updated>2010-11-22T22:13:39Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Example.jpg]]=Background Concepts=&lt;br /&gt;
&lt;br /&gt;
To better understand this paper, it is very important to have a good understanding of the general concepts breached in it. For example, we all know what clocks are in our day-to-day life but what are they in the context of computing? In this section, we will describe concepts like timekeeping, hardware/software clocks, the advantages and disadvantages of the different available counters, synchronization algorithms and explains what is a para-virtualized system.&lt;br /&gt;
&lt;br /&gt;
===Timekeeping===&lt;br /&gt;
&lt;br /&gt;
Since thousands of years, men have tried to find better ways to keep track of time. From sundials to atomic clocks, they were all made for the specific purpose of measuring the passage of time. This is not so different in computer operating systems. It is typically done in one of two ways: tick counting and tickless timekeeping[1]. Tick counting is when the operating system sets up an hardware device, generally a CPU, to interrupt at a certain rate. So each time one of those interrupts are called(a tick), the operating system will keep track of it in a counter. That will tell the system how much time has passed. In tickless timekeeping, instead of the OS keeping track of time through interrupts, a hardware device is used instead starting its own counter when the system is booted. The OS just need to read the counter from it when needed. Tickless timekeeping seems to be the better way to keep track of time because it doesn’t hog the CPU with hardware interrupts however, its performance is very dependent on the type of hardware used. Another disadvantages is that they tend to drift and can cause inaccuracy. I will explains those drifts later. But both of these are just counters. They don’t know what is the actual real-time. To remedy that, either a computer gets its time from a battery-backed real-time clock or it queries a network time server(NTP) to get the current time. The computer can also use software in the form of a daemon that will run periodically to make adjustments to the time.&lt;br /&gt;
&lt;br /&gt;
===Clocks===&lt;br /&gt;
&lt;br /&gt;
Computer “clocks” or “timers” can be hardware based, software based or they can even be an hybrid. The most commonly found timer is the hardware timer. All of the hardware timers can be generally described by this diagram where some have either more or less features:&lt;br /&gt;
&lt;br /&gt;
Diagram1. Timer Abstraction&lt;br /&gt;
&lt;br /&gt;
[[Image:http://homeostasis.scs.carleton.ca/wiki/index.php/File:Timerabstract.jpg]]&lt;br /&gt;
&lt;br /&gt;
This diagram nicely represent how tick counting works[2]. The oscillator runs at a predetermine frequency. The operating system might have to mesure it when the system boots. The counter starts with a predetermined value which can be set by software. For every cycle of the oscillator, the counter counts down one unit. When it reaches zero, its generates an output signal that might interrupt the CPU. That same interrupt will then allow the counter’s initial value to be reloaded into the counter and the process begins again.&lt;br /&gt;
&lt;br /&gt;
===Timers===&lt;br /&gt;
# PIT&lt;br /&gt;
# CMOS RTC&lt;br /&gt;
# Local APIC&lt;br /&gt;
# ACPI&lt;br /&gt;
# TSC&lt;br /&gt;
# HPET&lt;br /&gt;
&lt;br /&gt;
==Guest Timekeeping==&lt;br /&gt;
This section will explain why timing is different for guest operating systems.&lt;br /&gt;
===Sources of Drift===&lt;br /&gt;
Discuss what causes the problem in virtual environments. Consider para-virtual and full-virtual architectures.&lt;br /&gt;
===Impact of Drift===&lt;br /&gt;
Discuss the impact of error on a few real-world applications.&lt;br /&gt;
===Compensation Strategies===&lt;br /&gt;
Discuss common strategies in VM software and in operating systems to compensate for drift. Discuss what happens when the clock is slow and fast.&lt;br /&gt;
&lt;br /&gt;
=Research problem=&lt;br /&gt;
=Contribution=&lt;br /&gt;
=Critique=&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. Timekeeping in Virtual Machines, Information Guide from VMWare. http://www.vmware.com/files/pdf/Timekeeping-In-VirtualMachines.pdf&lt;br /&gt;
2. Modern Operating System 3rd Edition, by Andrew S. Tanenbaum, published by Pearson.&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_2_2010_Question_11&amp;diff=5395</id>
		<title>COMP 3000 Essay 2 2010 Question 11</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_2_2010_Question_11&amp;diff=5395"/>
		<updated>2010-11-22T22:10:34Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Background Concepts=&lt;br /&gt;
&lt;br /&gt;
To better understand this paper, it is very important to have a good understanding of the general concepts breached in it. For example, we all know what clocks are in our day-to-day life but what are they in the context of computing? In this section, we will describe concepts like timekeeping, hardware/software clocks, the advantages and disadvantages of the different available counters, synchronization algorithms and explains what is a para-virtualized system.&lt;br /&gt;
&lt;br /&gt;
===Timekeeping===&lt;br /&gt;
&lt;br /&gt;
Since thousands of years, men have tried to find better ways to keep track of time. From sundials to atomic clocks, they were all made for the specific purpose of measuring the passage of time. This is not so different in computer operating systems. It is typically done in one of two ways: tick counting and tickless timekeeping[1]. Tick counting is when the operating system sets up an hardware device, generally a CPU, to interrupt at a certain rate. So each time one of those interrupts are called(a tick), the operating system will keep track of it in a counter. That will tell the system how much time has passed. In tickless timekeeping, instead of the OS keeping track of time through interrupts, a hardware device is used instead starting its own counter when the system is booted. The OS just need to read the counter from it when needed. Tickless timekeeping seems to be the better way to keep track of time because it doesn’t hog the CPU with hardware interrupts however, its performance is very dependent on the type of hardware used. Another disadvantages is that they tend to drift and can cause inaccuracy. I will explains those drifts later. But both of these are just counters. They don’t know what is the actual real-time. To remedy that, either a computer gets its time from a battery-backed real-time clock or it queries a network time server(NTP) to get the current time. The computer can also use software in the form of a daemon that will run periodically to make adjustments to the time.&lt;br /&gt;
&lt;br /&gt;
===Clocks===&lt;br /&gt;
&lt;br /&gt;
Computer “clocks” or “timers” can be hardware based, software based or they can even be an hybrid. The most commonly found timer is the hardware timer. All of the hardware timers can be generally described by this diagram where some have either more or less features:&lt;br /&gt;
&lt;br /&gt;
Diagram1. Timer Abstraction&lt;br /&gt;
&lt;br /&gt;
[[Image:Timerdiagram.jpg]]&lt;br /&gt;
&lt;br /&gt;
This diagram nicely represent how tick counting works[2]. The oscillator runs at a predetermine frequency. The operating system might have to mesure it when the system boots. The counter starts with a predetermined value which can be set by software. For every cycle of the oscillator, the counter counts down one unit. When it reaches zero, its generates an output signal that might interrupt the CPU. That same interrupt will then allow the counter’s initial value to be reloaded into the counter and the process begins again.&lt;br /&gt;
&lt;br /&gt;
===Timers===&lt;br /&gt;
# PIT&lt;br /&gt;
# CMOS RTC&lt;br /&gt;
# Local APIC&lt;br /&gt;
# ACPI&lt;br /&gt;
# TSC&lt;br /&gt;
# HPET&lt;br /&gt;
&lt;br /&gt;
==Guest Timekeeping==&lt;br /&gt;
This section will explain why timing is different for guest operating systems.&lt;br /&gt;
===Sources of Drift===&lt;br /&gt;
Discuss what causes the problem in virtual environments. Consider para-virtual and full-virtual architectures.&lt;br /&gt;
===Impact of Drift===&lt;br /&gt;
Discuss the impact of error on a few real-world applications.&lt;br /&gt;
===Compensation Strategies===&lt;br /&gt;
Discuss common strategies in VM software and in operating systems to compensate for drift. Discuss what happens when the clock is slow and fast.&lt;br /&gt;
&lt;br /&gt;
=Research problem=&lt;br /&gt;
=Contribution=&lt;br /&gt;
=Critique=&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. Timekeeping in Virtual Machines, Information Guide from VMWare. http://www.vmware.com/files/pdf/Timekeeping-In-VirtualMachines.pdf&lt;br /&gt;
2. Modern Operating System 3rd Edition, by Andrew S. Tanenbaum, published by Pearson.&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_2_2010_Question_11&amp;diff=5394</id>
		<title>COMP 3000 Essay 2 2010 Question 11</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_2_2010_Question_11&amp;diff=5394"/>
		<updated>2010-11-22T22:08:08Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Background Concepts=&lt;br /&gt;
&lt;br /&gt;
To better understand this paper, it is very important to have a good understanding of the general concepts breached in it. For example, we all know what clocks are in our day-to-day life but what are they in the context of computing? In this section, we will describe concepts like timekeeping, hardware/software clocks, the advantages and disadvantages of the different available counters, synchronization algorithms and explains what is a para-virtualized system.&lt;br /&gt;
&lt;br /&gt;
===Timekeeping===&lt;br /&gt;
&lt;br /&gt;
Since thousands of years, men have tried to find better ways to keep track of time. From sundials to atomic clocks, they were all made for the specific purpose of measuring the passage of time. This is not so different in computer operating systems. It is typically done in one of two ways: tick counting and tickless timekeeping[1]. Tick counting is when the operating system sets up an hardware device, generally a CPU, to interrupt at a certain rate. So each time one of those interrupts are called(a tick), the operating system will keep track of it in a counter. That will tell the system how much time has passed. In tickless timekeeping, instead of the OS keeping track of time through interrupts, a hardware device is used instead starting its own counter when the system is booted. The OS just need to read the counter from it when needed. Tickless timekeeping seems to be the better way to keep track of time because it doesn’t hog the CPU with hardware interrupts however, its performance is very dependent on the type of hardware used. Another disadvantages is that they tend to drift and can cause inaccuracy. I will explains those drifts later. But both of these are just counters. They don’t know what is the actual real-time. To remedy that, either a computer gets its time from a battery-backed real-time clock or it queries a network time server(NTP) to get the current time. The computer can also use software in the form of a daemon that will run periodically to make adjustments to the time.&lt;br /&gt;
&lt;br /&gt;
===Clocks===&lt;br /&gt;
&lt;br /&gt;
Computer “clocks” or “timers” can be hardware based, software based or they can even be an hybrid. The most commonly found timer is the hardware timer. All of the hardware timers can be generally described by this diagram where some have either more or less features:&lt;br /&gt;
&lt;br /&gt;
Diagram1. Timer Abstraction&lt;br /&gt;
&lt;br /&gt;
[[File:Timerdiagram.jpg]]&lt;br /&gt;
&lt;br /&gt;
This diagram nicely represent how tick counting works[2]. The oscillator runs at a predetermine frequency. The operating system might have to mesure it when the system boots. The counter starts with a predetermined value which can be set by software. For every cycle of the oscillator, the counter counts down one unit. When it reaches zero, its generates an output signal that might interrupt the CPU. That same interrupt will then allow the counter’s initial value to be reloaded into the counter and the process begins again.&lt;br /&gt;
&lt;br /&gt;
===Timers===&lt;br /&gt;
# PIT&lt;br /&gt;
# CMOS RTC&lt;br /&gt;
# Local APIC&lt;br /&gt;
# ACPI&lt;br /&gt;
# TSC&lt;br /&gt;
# HPET&lt;br /&gt;
&lt;br /&gt;
==Guest Timekeeping==&lt;br /&gt;
This section will explain why timing is different for guest operating systems.&lt;br /&gt;
===Sources of Drift===&lt;br /&gt;
Discuss what causes the problem in virtual environments. Consider para-virtual and full-virtual architectures.&lt;br /&gt;
===Impact of Drift===&lt;br /&gt;
Discuss the impact of error on a few real-world applications.&lt;br /&gt;
===Compensation Strategies===&lt;br /&gt;
Discuss common strategies in VM software and in operating systems to compensate for drift. Discuss what happens when the clock is slow and fast.&lt;br /&gt;
&lt;br /&gt;
=Research problem=&lt;br /&gt;
=Contribution=&lt;br /&gt;
=Critique=&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. Timekeeping in Virtual Machines, Information Guide from VMWare. http://www.vmware.com/files/pdf/Timekeeping-In-VirtualMachines.pdf&lt;br /&gt;
2. Modern Operating System 3rd Edition, by Andrew S. Tanenbaum, published by Pearson.&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_2_2010_Question_11&amp;diff=5393</id>
		<title>COMP 3000 Essay 2 2010 Question 11</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_2_2010_Question_11&amp;diff=5393"/>
		<updated>2010-11-22T22:06:59Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Background Concepts=&lt;br /&gt;
&lt;br /&gt;
To better understand this paper, it is very important to have a good understanding of the general concepts breached in it. For example, we all know what clocks are in our day-to-day life but what are they in the context of computing? In this section, we will describe concepts like timekeeping, hardware/software clocks, the advantages and disadvantages of the different available counters, synchronization algorithms and explains what is a para-virtualized system.&lt;br /&gt;
&lt;br /&gt;
===Timekeeping===&lt;br /&gt;
&lt;br /&gt;
Since thousands of years, men have tried to find better ways to keep track of time. From sundials to atomic clocks, they were all made for the specific purpose of measuring the passage of time. This is not so different in computer operating systems. It is typically done in one of two ways: tick counting and tickless timekeeping[1]. Tick counting is when the operating system sets up an hardware device, generally a CPU, to interrupt at a certain rate. So each time one of those interrupts are called(a tick), the operating system will keep track of it in a counter. That will tell the system how much time has passed. In tickless timekeeping, instead of the OS keeping track of time through interrupts, a hardware device is used instead starting its own counter when the system is booted. The OS just need to read the counter from it when needed. Tickless timekeeping seems to be the better way to keep track of time because it doesn’t hog the CPU with hardware interrupts however, its performance is very dependent on the type of hardware used. Another disadvantages is that they tend to drift and can cause inaccuracy. I will explains those drifts later. But both of these are just counters. They don’t know what is the actual real-time. To remedy that, either a computer gets its time from a battery-backed real-time clock or it queries a network time server(NTP) to get the current time. The computer can also use software in the form of a daemon that will run periodically to make adjustments to the time.&lt;br /&gt;
&lt;br /&gt;
===Clocks===&lt;br /&gt;
&lt;br /&gt;
Computer “clocks” or “timers” can be hardware based, software based or they can even be an hybrid. The most commonly found timer is the hardware timer. All of the hardware timers can be generally described by this diagram where some have either more or less features:&lt;br /&gt;
&lt;br /&gt;
Diagram1. Timer Abstraction&lt;br /&gt;
&lt;br /&gt;
[[Media:Timerdiagram.jpg]]&lt;br /&gt;
&lt;br /&gt;
This diagram nicely represent how tick counting works[2]. The oscillator runs at a predetermine frequency. The operating system might have to mesure it when the system boots. The counter starts with a predetermined value which can be set by software. For every cycle of the oscillator, the counter counts down one unit. When it reaches zero, its generates an output signal that might interrupt the CPU. That same interrupt will then allow the counter’s initial value to be reloaded into the counter and the process begins again.&lt;br /&gt;
&lt;br /&gt;
===Timers===&lt;br /&gt;
# PIT&lt;br /&gt;
# CMOS RTC&lt;br /&gt;
# Local APIC&lt;br /&gt;
# ACPI&lt;br /&gt;
# TSC&lt;br /&gt;
# HPET&lt;br /&gt;
&lt;br /&gt;
==Guest Timekeeping==&lt;br /&gt;
This section will explain why timing is different for guest operating systems.&lt;br /&gt;
===Sources of Drift===&lt;br /&gt;
Discuss what causes the problem in virtual environments. Consider para-virtual and full-virtual architectures.&lt;br /&gt;
===Impact of Drift===&lt;br /&gt;
Discuss the impact of error on a few real-world applications.&lt;br /&gt;
===Compensation Strategies===&lt;br /&gt;
Discuss common strategies in VM software and in operating systems to compensate for drift. Discuss what happens when the clock is slow and fast.&lt;br /&gt;
&lt;br /&gt;
=Research problem=&lt;br /&gt;
=Contribution=&lt;br /&gt;
=Critique=&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. Timekeeping in Virtual Machines, Information Guide from VMWare. http://www.vmware.com/files/pdf/Timekeeping-In-VirtualMachines.pdf&lt;br /&gt;
2. Modern Operating System 3rd Edition, by Andrew S. Tanenbaum, published by Pearson.&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_2_2010_Question_11&amp;diff=5392</id>
		<title>COMP 3000 Essay 2 2010 Question 11</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_2_2010_Question_11&amp;diff=5392"/>
		<updated>2010-11-22T22:06:32Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Background Concepts=&lt;br /&gt;
&lt;br /&gt;
To better understand this paper, it is very important to have a good understanding of the general concepts breached in it. For example, we all know what clocks are in our day-to-day life but what are they in the context of computing? In this section, we will describe concepts like timekeeping, hardware/software clocks, the advantages and disadvantages of the different available counters, synchronization algorithms and explains what is a para-virtualized system.&lt;br /&gt;
&lt;br /&gt;
===Timekeeping===&lt;br /&gt;
&lt;br /&gt;
Since thousands of years, men have tried to find better ways to keep track of time. From sundials to atomic clocks, they were all made for the specific purpose of measuring the passage of time. This is not so different in computer operating systems. It is typically done in one of two ways: tick counting and tickless timekeeping[1]. Tick counting is when the operating system sets up an hardware device, generally a CPU, to interrupt at a certain rate. So each time one of those interrupts are called(a tick), the operating system will keep track of it in a counter. That will tell the system how much time has passed. In tickless timekeeping, instead of the OS keeping track of time through interrupts, a hardware device is used instead starting its own counter when the system is booted. The OS just need to read the counter from it when needed. Tickless timekeeping seems to be the better way to keep track of time because it doesn’t hog the CPU with hardware interrupts however, its performance is very dependent on the type of hardware used. Another disadvantages is that they tend to drift and can cause inaccuracy. I will explains those drifts later. But both of these are just counters. They don’t know what is the actual real-time. To remedy that, either a computer gets its time from a battery-backed real-time clock or it queries a network time server(NTP) to get the current time. The computer can also use software in the form of a daemon that will run periodically to make adjustments to the time.&lt;br /&gt;
&lt;br /&gt;
===Clocks===&lt;br /&gt;
&lt;br /&gt;
Computer “clocks” or “timers” can be hardware based, software based or they can even be an hybrid. The most commonly found timer is the hardware timer. All of the hardware timers can be generally described by this diagram where some have either more or less features:&lt;br /&gt;
&lt;br /&gt;
Diagram1. Timer Abstraction&lt;br /&gt;
&lt;br /&gt;
[File:Timerdiagram.jpg]&lt;br /&gt;
&lt;br /&gt;
This diagram nicely represent how tick counting works[2]. The oscillator runs at a predetermine frequency. The operating system might have to mesure it when the system boots. The counter starts with a predetermined value which can be set by software. For every cycle of the oscillator, the counter counts down one unit. When it reaches zero, its generates an output signal that might interrupt the CPU. That same interrupt will then allow the counter’s initial value to be reloaded into the counter and the process begins again.&lt;br /&gt;
&lt;br /&gt;
===Timers===&lt;br /&gt;
# PIT&lt;br /&gt;
# CMOS RTC&lt;br /&gt;
# Local APIC&lt;br /&gt;
# ACPI&lt;br /&gt;
# TSC&lt;br /&gt;
# HPET&lt;br /&gt;
&lt;br /&gt;
==Guest Timekeeping==&lt;br /&gt;
This section will explain why timing is different for guest operating systems.&lt;br /&gt;
===Sources of Drift===&lt;br /&gt;
Discuss what causes the problem in virtual environments. Consider para-virtual and full-virtual architectures.&lt;br /&gt;
===Impact of Drift===&lt;br /&gt;
Discuss the impact of error on a few real-world applications.&lt;br /&gt;
===Compensation Strategies===&lt;br /&gt;
Discuss common strategies in VM software and in operating systems to compensate for drift. Discuss what happens when the clock is slow and fast.&lt;br /&gt;
&lt;br /&gt;
=Research problem=&lt;br /&gt;
=Contribution=&lt;br /&gt;
=Critique=&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. Timekeeping in Virtual Machines, Information Guide from VMWare. http://www.vmware.com/files/pdf/Timekeeping-In-VirtualMachines.pdf&lt;br /&gt;
2. Modern Operating System 3rd Edition, by Andrew S. Tanenbaum, published by Pearson.&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_2_2010_Question_11&amp;diff=5391</id>
		<title>COMP 3000 Essay 2 2010 Question 11</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_2_2010_Question_11&amp;diff=5391"/>
		<updated>2010-11-22T22:05:10Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Background Concepts=&lt;br /&gt;
&lt;br /&gt;
To better understand this paper, it is very important to have a good understanding of the general concepts breached in it. For example, we all know what clocks are in our day-to-day life but what are they in the context of computing? In this section, we will describe concepts like timekeeping, hardware/software clocks, the advantages and disadvantages of the different available counters, synchronization algorithms and explains what is a para-virtualized system.&lt;br /&gt;
&lt;br /&gt;
===Timekeeping===&lt;br /&gt;
&lt;br /&gt;
Since thousands of years, men have tried to find better ways to keep track of time. From sundials to atomic clocks, they were all made for the specific purpose of measuring the passage of time. This is not so different in computer operating systems. It is typically done in one of two ways: tick counting and tickless timekeeping[1]. Tick counting is when the operating system sets up an hardware device, generally a CPU, to interrupt at a certain rate. So each time one of those interrupts are called(a tick), the operating system will keep track of it in a counter. That will tell the system how much time has passed. In tickless timekeeping, instead of the OS keeping track of time through interrupts, a hardware device is used instead starting its own counter when the system is booted. The OS just need to read the counter from it when needed. Tickless timekeeping seems to be the better way to keep track of time because it doesn’t hog the CPU with hardware interrupts however, its performance is very dependent on the type of hardware used. Another disadvantages is that they tend to drift and can cause inaccuracy. I will explains those drifts later. But both of these are just counters. They don’t know what is the actual real-time. To remedy that, either a computer gets its time from a battery-backed real-time clock or it queries a network time server(NTP) to get the current time. The computer can also use software in the form of a daemon that will run periodically to make adjustments to the time.&lt;br /&gt;
&lt;br /&gt;
===Clocks===&lt;br /&gt;
&lt;br /&gt;
Computer “clocks” or “timers” can be hardware based, software based or they can even be an hybrid. The most commonly found timer is the hardware timer. All of the hardware timers can be generally described by this diagram where some have either more or less features:&lt;br /&gt;
&lt;br /&gt;
Diagram1. Timer Abstraction&lt;br /&gt;
&lt;br /&gt;
[[File:Timerdiagram.jpg]]&lt;br /&gt;
&lt;br /&gt;
This diagram nicely represent how tick counting works[2]. The oscillator runs at a predetermine frequency. The operating system might have to mesure it when the system boots. The counter starts with a predetermined value which can be set by software. For every cycle of the oscillator, the counter counts down one unit. When it reaches zero, its generates an output signal that might interrupt the CPU. That same interrupt will then allow the counter’s initial value to be reloaded into the counter and the process begins again.&lt;br /&gt;
&lt;br /&gt;
===Timers===&lt;br /&gt;
# PIT&lt;br /&gt;
# CMOS RTC&lt;br /&gt;
# Local APIC&lt;br /&gt;
# ACPI&lt;br /&gt;
# TSC&lt;br /&gt;
# HPET&lt;br /&gt;
&lt;br /&gt;
==Guest Timekeeping==&lt;br /&gt;
This section will explain why timing is different for guest operating systems.&lt;br /&gt;
===Sources of Drift===&lt;br /&gt;
Discuss what causes the problem in virtual environments. Consider para-virtual and full-virtual architectures.&lt;br /&gt;
===Impact of Drift===&lt;br /&gt;
Discuss the impact of error on a few real-world applications.&lt;br /&gt;
===Compensation Strategies===&lt;br /&gt;
Discuss common strategies in VM software and in operating systems to compensate for drift. Discuss what happens when the clock is slow and fast.&lt;br /&gt;
&lt;br /&gt;
=Research problem=&lt;br /&gt;
=Contribution=&lt;br /&gt;
=Critique=&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. Timekeeping in Virtual Machines, Information Guide from VMWare. http://www.vmware.com/files/pdf/Timekeeping-In-VirtualMachines.pdf&lt;br /&gt;
2. Modern Operating System 3rd Edition, by Andrew S. Tanenbaum, published by Pearson.&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=File:Timerabstract.jpg&amp;diff=5390</id>
		<title>File:Timerabstract.jpg</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=File:Timerabstract.jpg&amp;diff=5390"/>
		<updated>2010-11-22T22:02:47Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: uploaded a new version of &amp;quot;File:Timerabstract.jpg&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Describes a general abstraction on the workings of a clock(timer).&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=File:Timerabstract.jpg&amp;diff=5387</id>
		<title>File:Timerabstract.jpg</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=File:Timerabstract.jpg&amp;diff=5387"/>
		<updated>2010-11-22T21:42:28Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: Describes a general abstraction on the workings of a clock(timer).&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Describes a general abstraction on the workings of a clock(timer).&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_2_2010_Question_11&amp;diff=5385</id>
		<title>COMP 3000 Essay 2 2010 Question 11</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_2_2010_Question_11&amp;diff=5385"/>
		<updated>2010-11-22T21:40:43Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Background Concepts=&lt;br /&gt;
&lt;br /&gt;
To better understand this paper, it is very important to have a good understanding of the general concepts breached in it. For example, we all know what clocks are in our day-to-day life but what are they in the context of computing? In this section, we will describe concepts like timekeeping, hardware/software clocks, the advantages and disadvantages of the different available counters, synchronization algorithms and explains what is a para-virtualized system.&lt;br /&gt;
&lt;br /&gt;
===Timekeeping===&lt;br /&gt;
&lt;br /&gt;
Since thousands of years, men have tried to find better ways to keep track of time. From sundials to atomic clocks, they were all made for the specific purpose of measuring the passage of time. This is not so different in computer operating systems. It is typically done in one of two ways: tick counting and tickless timekeeping[1]. Tick counting is when the operating system sets up an hardware device, generally a CPU, to interrupt at a certain rate. So each time one of those interrupts are called(a tick), the operating system will keep track of it in a counter. That will tell the system how much time has passed. In tickless timekeeping, instead of the OS keeping track of time through interrupts, a hardware device is used instead starting its own counter when the system is booted. The OS just need to read the counter from it when needed. Tickless timekeeping seems to be the better way to keep track of time because it doesn’t hog the CPU with hardware interrupts however, its performance is very dependent on the type of hardware used. Another disadvantages is that they tend to drift and can cause inaccuracy. I will explains those drifts later. But both of these are just counters. They don’t know what is the actual real-time. To remedy that, either a computer gets its time from a battery-backed real-time clock or it queries a network time server(NTP) to get the current time. The computer can also use software in the form of a daemon that will run periodically to make adjustments to the time.&lt;br /&gt;
&lt;br /&gt;
===Clocks===&lt;br /&gt;
&lt;br /&gt;
Computer “clocks” or “timers” can be hardware based, software based or they can even be an hybrid. The most commonly found timer is the hardware timer. All of the hardware timers can be generally described by this diagram where some have either more or less features:&lt;br /&gt;
&lt;br /&gt;
Diagram1. Timer Abstraction&lt;br /&gt;
&lt;br /&gt;
This diagram nicely represent how tick counting works[2]. The oscillator runs at a predetermine frequency. The operating system might have to mesure it when the system boots. The counter starts with a predetermined value which can be set by software. For every cycle of the oscillator, the counter counts down one unit. When it reaches zero, its generates an output signal that might interrupt the CPU. That same interrupt will then allow the counter’s initial value to be reloaded into the counter and the process begins again.&lt;br /&gt;
&lt;br /&gt;
===Timers===&lt;br /&gt;
# PIT&lt;br /&gt;
# CMOS RTC&lt;br /&gt;
# Local APIC&lt;br /&gt;
# ACPI&lt;br /&gt;
# TSC&lt;br /&gt;
# HPET&lt;br /&gt;
&lt;br /&gt;
==Guest Timekeeping==&lt;br /&gt;
This section will explain why timing is different for guest operating systems.&lt;br /&gt;
===Sources of Drift===&lt;br /&gt;
Discuss what causes the problem in virtual environments. Consider para-virtual and full-virtual architectures.&lt;br /&gt;
===Impact of Drift===&lt;br /&gt;
Discuss the impact of error on a few real-world applications.&lt;br /&gt;
===Compensation Strategies===&lt;br /&gt;
Discuss common strategies in VM software and in operating systems to compensate for drift. Discuss what happens when the clock is slow and fast.&lt;br /&gt;
&lt;br /&gt;
=Research problem=&lt;br /&gt;
=Contribution=&lt;br /&gt;
=Critique=&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
1. Timekeeping in Virtual Machines, Information Guide from VMWare. http://www.vmware.com/files/pdf/Timekeeping-In-VirtualMachines.pdf&lt;br /&gt;
2. Modern Operating System 3rd Edition, by Andrew S. Tanenbaum, published by Pearson.&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=Talk:COMP_3000_Essay_2_2010_Question_11&amp;diff=5384</id>
		<title>Talk:COMP 3000 Essay 2 2010 Question 11</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=Talk:COMP_3000_Essay_2_2010_Question_11&amp;diff=5384"/>
		<updated>2010-11-22T21:29:12Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
--[[User:Sblais2|Sblais2]] 21:29, 22 November 2010 (UTC) I have added a small part to the background section. I have created by hand a diagram explaining how it works. I tried to find an original way of doing it but it is the same diagram everywhere. Please feel free to comment here or by sending me an email.&lt;br /&gt;
&lt;br /&gt;
--[[User:AbsMechanik|AbsMechanik]] 19:46, 22 November 2010 (UTC) Here&#039;s what my research has led me to so far. I&#039;m trying to come up with good points for the research problem, contribution and critique part of this essay. Here&#039;s a bunch of links, I&#039;ve come across. I think there will be a few more tonight. Feel free to read through &#039;em: &lt;br /&gt;
&amp;lt;br&amp;gt;http://www.vmware.com/files/pdf/Timekeeping-In-VirtualMachines.pdf&lt;br /&gt;
&amp;lt;br&amp;gt;http://www.xen.org/files/xen_interface.pdf&lt;br /&gt;
&amp;lt;br&amp;gt;http://www.microsoft.com/whdc/system/sysinternals/mm-timer.mspx&lt;br /&gt;
&amp;lt;br&amp;gt;http://www.intel.com/hardwaredesign/hpetspec_1.pdf&lt;br /&gt;
&amp;lt;br&amp;gt;http://www.cubinlab.ee.unimelb.edu.au/radclock/&lt;br /&gt;
&lt;br /&gt;
--[[User:ScottG|ScottG]] 18:55, 22 November 2010 (UTC) I&#039;m good taking the Guest Timekeeping section. Hopefully I&#039;ll have some stuff up tonight or early tomorrow for it.&lt;br /&gt;
&lt;br /&gt;
--[[User:Sblais2|Sblais2]] 17:14, 22 November 2010 (UTC) I will be working on the Background section. I will dedicate it to explain some of the key concepts that are used in the research paper that will allow the readers to have a better understanding on the rest of our essay. The structure you&#039;ve put in place looks good but it might get modified, depending on the text will flow. The diagram is a good idea. I will drawn a simple one and add it in. Feel free again to critique.&lt;br /&gt;
&lt;br /&gt;
--[[User:Jjpwilso|Jjpwilso]] 15:12, 16 November 2010 (UTC) I wanted to get a structure started, so I have stubbed out the first section. Note: some of the sub-sections might belong in the Research Problem section but we can easily move them if they fit there. Let&#039;s use this area to plan who is doing what. Feel free to critique any of my submissions. When you comment here, please put your comments at the very top so we can easily see recent posts.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Participants=&lt;br /&gt;
(X) Blais   Sylvain sblais2 - Email: syl20blais@gmail.com&amp;lt;br&amp;gt;&lt;br /&gt;
(X) Graham  Scott   sgraham6&amp;lt;br&amp;gt;&lt;br /&gt;
(X) Ilitchev Fedor  filitche fedor dot ilitchev at gmail dot com &amp;lt;br&amp;gt; &lt;br /&gt;
(X) Panke   Shane   spanke&amp;lt;br&amp;gt;&lt;br /&gt;
(X) Shukla  Abhinav ashukla2&amp;lt;br&amp;gt;&lt;br /&gt;
(X) Wilson  Robert  jjpwilso&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=Talk:COMP_3000_Essay_2_2010_Question_11&amp;diff=5340</id>
		<title>Talk:COMP 3000 Essay 2 2010 Question 11</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=Talk:COMP_3000_Essay_2_2010_Question_11&amp;diff=5340"/>
		<updated>2010-11-22T17:15:04Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;--[[User:Sblais2|Sblais2]] 17:14, 22 November 2010 (UTC) I will be working on the Background section. I will dedicate it to explain some of the key concepts that are used in the research paper that will allow the readers to have a better understanding on the rest of our essay. The structure you&#039;ve put in place looks good but it might get modified, depending on the text will flow. The diagram is a good idea. I will drawn a simple one and add it in. Feel free again to critique.&lt;br /&gt;
&lt;br /&gt;
--[[User:Jjpwilso|Jjpwilso]] 15:12, 16 November 2010 (UTC) I wanted to get a structure started, so I have stubbed out the first section. Note: some of the sub-sections might belong in the Research Problem section but we can easily move them if they fit there. Let&#039;s use this area to plan who is doing what. Feel free to critique any of my submissions. When you comment here, please put your comments at the very top so we can easily see recent posts.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Participants=&lt;br /&gt;
(X) Blais   Sylvain sblais2 - Email: syl20blais@gmail.com&amp;lt;br&amp;gt;&lt;br /&gt;
(X) Graham  Scott   sgraham6&amp;lt;br&amp;gt;&lt;br /&gt;
(X) Ilitchev Fedor  filitche fedor dot ilitchev at gmail dot com &amp;lt;br&amp;gt; &lt;br /&gt;
(X) Panke   Shane   spanke&amp;lt;br&amp;gt;&lt;br /&gt;
(X) Shukla  Abhinav ashukla2&amp;lt;br&amp;gt;&lt;br /&gt;
(X) Wilson  Robert  jjpwilso&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=Talk:COMP_3000_Essay_2_2010_Question_11&amp;diff=5339</id>
		<title>Talk:COMP 3000 Essay 2 2010 Question 11</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=Talk:COMP_3000_Essay_2_2010_Question_11&amp;diff=5339"/>
		<updated>2010-11-22T17:14:43Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;----[[User:Sblais2|Sblais2]] 17:14, 22 November 2010 (UTC) I will be working on the Background section. I will dedicate it to explain some of the key concepts that are used in the research paper that will allow the readers to have a better understanding on the rest of our essay. The structure you&#039;ve put in place looks good but it might get modified, depending on the text will flow. The diagram is a good idea. I will drawn a simple one and add it in. Feel free again to critique.&lt;br /&gt;
&lt;br /&gt;
--[[User:Jjpwilso|Jjpwilso]] 15:12, 16 November 2010 (UTC) I wanted to get a structure started, so I have stubbed out the first section. Note: some of the sub-sections might belong in the Research Problem section but we can easily move them if they fit there. Let&#039;s use this area to plan who is doing what. Feel free to critique any of my submissions. When you comment here, please put your comments at the very top so we can easily see recent posts.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Participants=&lt;br /&gt;
(X) Blais   Sylvain sblais2 - Email: syl20blais@gmail.com&amp;lt;br&amp;gt;&lt;br /&gt;
(X) Graham  Scott   sgraham6&amp;lt;br&amp;gt;&lt;br /&gt;
(X) Ilitchev Fedor  filitche fedor dot ilitchev at gmail dot com &amp;lt;br&amp;gt; &lt;br /&gt;
(X) Panke   Shane   spanke&amp;lt;br&amp;gt;&lt;br /&gt;
(X) Shukla  Abhinav ashukla2&amp;lt;br&amp;gt;&lt;br /&gt;
(X) Wilson  Robert  jjpwilso&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=Talk:COMP_3000_Essay_2_2010_Question_11&amp;diff=5013</id>
		<title>Talk:COMP 3000 Essay 2 2010 Question 11</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=Talk:COMP_3000_Essay_2_2010_Question_11&amp;diff=5013"/>
		<updated>2010-11-15T18:48:34Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Please mark an X if you are able to participate.&lt;br /&gt;
&lt;br /&gt;
(X) Blais   Sylvain sblais2 - Email: syl20blais@gmail.com&amp;lt;br&amp;gt;&lt;br /&gt;
(X) Graham  Scott   sgraham6&amp;lt;br&amp;gt;&lt;br /&gt;
(X) Ilitchev Fedor  filitche fedor dot ilitchev at gmail dot com &amp;lt;br&amp;gt; &lt;br /&gt;
(X) Panke   Shane   spanke&amp;lt;br&amp;gt;&lt;br /&gt;
(X) Shukla  Abhinav ashukla2&amp;lt;br&amp;gt;&lt;br /&gt;
(X) Wilson  Robert  jjpwilso&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=Talk:COMP_3000_Essay_2_2010_Question_11&amp;diff=4931</id>
		<title>Talk:COMP 3000 Essay 2 2010 Question 11</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=Talk:COMP_3000_Essay_2_2010_Question_11&amp;diff=4931"/>
		<updated>2010-11-11T23:46:02Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Please mark an X if you are able to participate.&lt;br /&gt;
&lt;br /&gt;
(X) Blais   Sylvain sblais2&amp;lt;br&amp;gt;&lt;br /&gt;
(X) Graham  Scott   sgraham6&amp;lt;br&amp;gt;&lt;br /&gt;
( ) Ilitchev Fedor  filitche&amp;lt;br&amp;gt;&lt;br /&gt;
( ) Panke   Shane   spanke&amp;lt;br&amp;gt;&lt;br /&gt;
( ) Shukla  Abhinav ashukla2&amp;lt;br&amp;gt;&lt;br /&gt;
(X) Wilson  Robert  jjpwilso&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_1_2010_Question_2&amp;diff=4697</id>
		<title>COMP 3000 Essay 1 2010 Question 2</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_1_2010_Question_2&amp;diff=4697"/>
		<updated>2010-10-15T10:15:06Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: /* File Management Calls */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Question=&lt;br /&gt;
How do the available system calls in modern versions of the Linux Kernel (2.6.30+) compare with the system calls available in the earliest versions of UNIX? How has the system call interface been expanded, and why? Focus on major changes or extensions in functionality.&lt;br /&gt;
&lt;br /&gt;
=Answer=&lt;br /&gt;
&lt;br /&gt;
A system call is a mean by which programs in the user space can access kernel services. Systems calls vary from operating system to operating system, although the underlying concepts tends to be the same. In general, a process is not supposed to be able to access the kernel directly. It can&#039;t access kernel memory and it can&#039;t call kernel functions. When the CPU prevents a process from accessing the kernel, this prevention is commonly known as, the protected mode. On the other hand, system calls are an exception to this rule. For example, older x86 processors used an interrupt mechanism to go from user-space to kernel-space, but newer processor (PentiumII+) provided instructions that optimize this transition using sysenter and sysexit instructions (Hayward, Mike. Intel P6 vs P7 system call performance. [http://lkml.org/lkml/2002/12/9/13], December 9, 2002).  All system calls are small programs built using the C programming language.&lt;br /&gt;
&lt;br /&gt;
The Unix and Linux systems calls are roughly grouped into 6 major categories: file management, device management, information maintenance, process control, communications and miscellaneous calls. The miscellaneous calls are all the ones that don’t really fit in the other categories, like system calls dealing with errors. Today, the Unix and Linux operating system contains hundreds of system calls but in general, they all came from the 35 system calls that came with one of the original UNIX OS in the early 70s. In the next paragraphs, we’re going to describe the various system calls in each of the categories mentioned above, their evolution through history (major changes in functionality) and a comparison with the earliest versions of UNIX.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== File Management Calls==&lt;br /&gt;
&lt;br /&gt;
The system calls in this group deal with every type of operation that is required to run a file system in the operating system. Create file, delete file, opening a file and closing a file are just a few examples of them and most of them hardly changed throughout the years. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;chmod&#039;&#039;, &#039;&#039;chown&#039;&#039; and &#039;&#039;chdir&#039;&#039; have been available since the first original UNIX (1971) and they are still used in today’s Linux kernels. The &#039;&#039;chmod&#039;&#039; and &#039;&#039;chown&#039;&#039; calls allows the users to change the file attributes and implements security to the file system. The system call &#039;&#039;chdir&#039;&#039; allows the process to change the current working directory. In the 4th distribution of UNIX from Berkeley (4BSD), new system calls were added to give more control of the file system to the applications. The call &#039;&#039;chroot&#039;&#039;  allows the process to change the current root directory with one specified in a path argument. &#039;&#039;fchmod&#039;&#039; and &#039;&#039;fchdir&#039;&#039; are the same as &#039;&#039;chmod&#039;&#039; and &#039;&#039;chdir&#039;&#039; except they takes file descriptors as arguments. As of Linux kernel 2.1.81, the &#039;&#039;chown&#039;&#039; system call now follows symbolic links and therefore, they introduced a new system call, &#039;&#039;lchown&#039;&#039;, that does not follow symbolic links.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another four of the original UNIX system calls are &#039;&#039;open&#039;&#039;, &#039;&#039;creat&#039;&#039;, &#039;&#039;mkdir&#039;&#039; and &#039;&#039;close&#039;&#039;. The &#039;&#039;open&#039;&#039; and &#039;&#039;creat&#039;&#039; calls allows processes to open and possibly create a file or device. Arguments flags are used to set from access modes, like O_RDONLY(read-only), to status flags, like O_APPEND(append mode). The only modifications made to the system calls were the addition of status flags where some of them are linux-specific. The &#039;&#039;close&#039;&#039; call allows processes to close a file descriptor preventing it to be reused. No changes were made to it. &#039;&#039;mkdir&#039;&#039; allows the creation of a file directory. In the earliest version of Unix, to delete a directory, users needed to make a series of &#039;&#039;link&#039;&#039; and &#039;&#039;unlink&#039;&#039; system calls. With Unix 4.2BSD, &#039;&#039;rmdir&#039;&#039; was added and helped solve the problem. The &#039;&#039;rename&#039;&#039; call was also added in 4.2BSD allowing processes to change the name or the location of a file. As file system became more complex, these new system calls helped the users gain better control over them.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is also system calls used to find, access and modify files. They are &#039;&#039;read&#039;&#039;, &#039;&#039;write&#039;&#039;, &#039;&#039;seek&#039;&#039; and &#039;&#039;stat&#039;&#039;. These were also part of the first UNIX built. The &#039;&#039;read&#039;&#039; and &#039;&#039;write&#039;&#039; system calls allows to read and write from a file (assigned to a file descriptor). The only change was in the Unix System V release 4(SVR4) where a &#039;&#039;write&#039;&#039; call could be interrupted at anytime. The &#039;&#039;seek&#039;&#039; system calls is used to go to a specified position in a file. This calls used a 16 bit address to determine its position in a file(also called offset). But this was replaced very quickly for &#039;&#039;lseek&#039;&#039; as early as SVR4. It allows the call to use 32 bit address enabling the users more flexibility when reading or writing files especially for large ones. It is still used in modern Linux and Unix systems. As of now, developers are trying to implement &#039;&#039;lseek64&#039;&#039;, a system call that will use 64 bit addresses. The &#039;&#039;stat&#039;&#039; system calls allows processes to get the status of a file. With SVR4, 2 other version of that system call were created: &#039;&#039;fstat&#039;&#039; and &#039;&#039;lstat&#039;&#039;. They both do the same thing except &#039;&#039;lstat&#039;&#039; give the status of symbolic links and &#039;&#039;fstat&#039;&#039; give the status of a file specified by a file descriptor. Different operating systems will output different values to represent the state of a file. Since kernel 2.5.48, the stat returned a nanoseconds field in the file’s timestamp. With the release of 4.4BSD, two new system calls called &#039;&#039;statvfs&#039;&#039; and &#039;&#039;fstatvfs&#039;&#039; were introduced to provide information about a mounted file system. They both do the same thing except fstatvfs takes file descriptors as an argument. These calls are only used in an UNIX environment. In Linux, it has &#039;&#039;statfs&#039;&#039; and &#039;&#039;fstatfs&#039;&#039; to support that same call.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last two original UNIX system calls in this category that are still used today are &#039;&#039;link&#039;&#039; and &#039;&#039;unlink&#039;&#039;. &#039;&#039;link&#039;&#039; creates a hard link to an existing file and &#039;&#039;unlink&#039;&#039; deletes a file link’s name and possibly the file it refers to. If the name refers to a symbolic link, only the link is removed. No major changes were done to the &#039;&#039;unlink&#039;&#039; system calls but new system calls were create from &#039;&#039;link&#039;&#039;. The &#039;&#039;symlink&#039;&#039; system call was added in 4.2BSD to allow the creation of symbolic links in the file system. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the Linux 2.6.16 build, multiple system calls were created so that the calls could deal with relative pathnames as arguments. They can easily be spotted as the system call names all finish with &#039;at&#039;. Here is a sample list of the created system calls: &#039;&#039;openat&#039;&#039;, &#039;&#039;mkdirat&#039;&#039;, &#039;&#039;fchmodat&#039;&#039;, &#039;&#039;fchownat&#039;&#039;, &#039;&#039;fstatat&#039;&#039;, &#039;&#039;linkat&#039;&#039;, &#039;&#039;unlinkat&#039;&#039;, &#039;&#039;renameat&#039;&#039; and &#039;&#039;fchmodat&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Device Management Calls==&lt;br /&gt;
&lt;br /&gt;
The device management system calls are linked to hardware and they are mainly used to requests for devices, release devices, to logically attach a device or to detach it, get and modified device attributes and read and write to them. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two of the most important system calls for the UNIX and Linux operating system is &#039;&#039;mount&#039;&#039; and &#039;&#039;umount&#039;&#039;. These were among the few system calls available in the first version of UNIX in 1971. The two calls allowed the operating system to load file systems on storage devices. A few changes were done to the mount system calls. Most of these changes were the creation of new mount flags to enhance performance. For example, since Linux 2.5.19, the MS_DIRSYNC flag permits the directory changes on a file system synchronous. Another Linux improvement was to provide per-process mount namespaces. This was added on the 2.4.19 kernel. If a process was created using the &#039;&#039;clone&#039;&#039; system call with the CLONE_NEWNS flag, the process will have a new namespace initialized to be a copy of the namespace of the process that was cloned. The &#039;&#039;umount&#039;&#039; system call unmounted the file system from the storage device. The only noteworthy change to &#039;&#039;umount&#039;&#039; was the creation of ‘‘umount2’’ in Linux 2.1.116. It is the same as &#039;&#039;umount&#039;&#039; except it allows different flags to control the operation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;open&#039;&#039;, &#039;&#039;read&#039;&#039; and &#039;&#039;write&#039;&#039; calls can also be used to access devices. As discussed in the previous section, arguments flags are used to better control the device. You would use them as if the devices were files using the appropriate flags.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With the SVR4 came the system call &#039;&#039;mmap&#039;&#039;. This system call is used to map or unmap files or devices into memory. Once a device is mapped, the system call returns a pointer to the mapped area allowing processes to access that device. This system call is still used in a Unix environment but since Linux 2.4, Linux replaced it by the mmap2 system call. It is basically the same as mmap except for a final argument specifying the offset into a file in 4096-byte units. This enables the mapping of large files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In version 7 of Unix, &#039;&#039;ioctl&#039;&#039; system call is used for device-specific operations that can’t be done using the standard system calls. This helps to deal with a multitude of devices. Each device drivers would provide a set of ioctl request code to allow various operations on their device. Each various request code are hardware dependent so there is no standard available for this system call.&lt;br /&gt;
&lt;br /&gt;
== Information Maintenance Calls==&lt;br /&gt;
Information maintenance calls are system calls that return the computers personal information back to the user or change it completely. These type of calls can be split up into three groups get/set time or date, get/set system data and get/set process, file, or device attributes. To fully understand the difference between Linux and UNIX in regrades to system calls, one must explore the three sub-types of information maintenance calls and see how they have changed over time.&lt;br /&gt;
&lt;br /&gt;
The first sub type is Get/set of time and/or date. In Linux, this can be done by a few different system calls, there are: &#039;gettimeofday&#039; to get the time, &#039;settimeofday&#039; to set it, &#039;time&#039; returns the time in seconds and a few other ones like &#039;ftime&#039;.In the earliest versions UNIX the used the system call was &#039;stime&#039;, which was used to  interact with time and dates. &#039;stime&#039; could return the time and date and sets the system’s idea of the time and date by altering the seconds. &#039;stime&#039; is still being used by Linux because it is successful, unlike &#039;settimeofday&#039;, which was created to change timezones (tz_dsttime) as well as the time but each occurrence of this field call in the kernel source (apart from declaration) is a bug thus failing. &lt;br /&gt;
&lt;br /&gt;
The second sub type is get/set system data. UNIX does this using the following commands: &#039;open&#039;, &#039;read&#039;, &#039;close&#039;, and &#039;write&#039;. &#039;open&#039; opens a file so the file can be written to or read from. &#039;read&#039; retrieves data from the file, and &#039;write&#039; modifies data in the file. &#039;close&#039; is used to indicate that the file is no longer in use. Linux uses the same set of commands for the same purposes.In addition to those system calls there Linux has there own unique system calls which are: &#039;olduname&#039; gets name and information about current kernel, similar to that is &#039;uname&#039; gets name and information about current kernel (which is used in the newer versions of UNIX not the older ones), &#039;iopl&#039; which changes I/O privilege level and &#039;sysfs&#039; which gets file system type information.&lt;br /&gt;
&lt;br /&gt;
The third sub type is get/set process, file, or device attributes, in UNIX there are several system calls for processing file and device attributes, some of these examples are common to both UNIX and Linux: &#039;stat&#039; gets file status, &#039;fork&#039; which spawns a new process, and &#039;stty&#039; which sets the mode of typewriter.The &#039;wait&#039; system call is used in both as well the only really difference is that in the Linux version wait store status information in a integer which take the integer itself as an argument, not a pointer to itself. In Linux there are a lot more system calls regarding this type and here are a few of them: &#039;capget&#039; gets the capabilities of the process, &#039;capset&#039; sets the capabilities process, &#039;getppid&#039; gets process identification. The &#039;capget&#039; and &#039;capset&#039; interact with the raw kernel interface to getting and setting thread capabilities. These two system calls are specific to Linux and as such the use of these functions (in particular the format of the cap_user_*_t types) are updated as the kernel is updated. The &#039;getppid&#039; returns the process ID of the calling process and never has any errors.&lt;br /&gt;
&lt;br /&gt;
== Process Control Calls==&lt;br /&gt;
&lt;br /&gt;
Process Control calls are system calls that handle the start, termination and other tasks that might be required &lt;br /&gt;
for a process to run correctly.&lt;br /&gt;
&lt;br /&gt;
In unix there are 10 system calls that make up Process Control Calls. These are:&lt;br /&gt;
&#039;&#039;fork()&#039;&#039;,&#039;&#039;wait()&#039;&#039;,&#039;&#039;execl()&#039;&#039;,&#039;&#039;execlp()&#039;&#039;,&#039;&#039;execle()&#039;&#039;,&#039;&#039;execvp()&#039;&#039;,&#039;&#039;execv()&#039;&#039;,&#039;&#039;execve()&#039;&#039;,&#039;&#039;exit()&#039;&#039;,&#039;&#039;signal()&#039;&#039;,&#039;&#039;kill()&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;fork()&#039;&#039;: It takes a process and creates an identical processes, which in turn makes one the parent process and the &lt;br /&gt;
other the child process. When &#039;&#039;fork()&#039;&#039; succeds it returns 0 to the child process and returns the PID of the child process to the parent process. When it fails, &#039;&#039;fork()&#039;&#039; returns -1 to the parent process.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;wait()&#039;&#039;: This call makes a parent process wait for the child process to end. It returns the pid of the child process that is &lt;br /&gt;
done. Wait fails if the process has no child process to wait for or its points to an invalid address.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;execl()&#039;&#039;,&#039;&#039;execlp()&#039;&#039;,&#039;&#039;execle()&#039;&#039;,&#039;&#039;execvp()&#039;&#039;,&#039;&#039;execv()&#039;&#039;, are system calls based on the same principle that the system call &lt;br /&gt;
takes as an argument a binary file and converts it into a process. When the system call works properly it does &lt;br /&gt;
not return, instead it gives control to the new process which replaces the process that called the system call.&lt;br /&gt;
each of these are called when different arguments are given.&lt;br /&gt;
&lt;br /&gt;
The following are the definitions for the these system calls as described by this [http://www.di.uevora.pt/~lmr/syscalls.html]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;execl()&#039;&#039;: Takes the path name of an executable program (binary file) as its first argument.  The rest of the arguments are a list of command&lt;br /&gt;
line arguments to the new program (argv[]).  The list terminated with a null pointer&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;execle()&#039;&#039;: Same as execl(), except that the end of the argument list is followed by a pointer to a null-terminated list of character&lt;br /&gt;
pointers that is passed a the environment of the new program&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;execv()&#039;&#039;: Takes the path name of an executable program (binary file) as it first argument.  The second argument is a pointer to a list of&lt;br /&gt;
character pointers (like argv[]) that is passed as command line arguments to the new program.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;execve()&#039;&#039;: Same as execv(), except that a third argument is given as a pointer to a list of character pointers (like argv[]) that is passed as the environment of the new program.&lt;br /&gt;
       &lt;br /&gt;
&#039;&#039;execlp()&#039;&#039;: Same as execl(), except that the program name doesn&#039;t have to be a full path name, and it can be a shell program instead of executable module.&lt;br /&gt;
&#039;&#039;execvp()&#039;&#039;: Same as execv(), except that the program name doesn&#039;t have to be a full path name, and it can be a shell program instead of an executable module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;signal()&#039;&#039;: This system call is sent to the process when the proper conditions are met. When the program receives the signal it can act in three different ways. The first is to ignore completely, it wont matter how many times the signal is sent the process will not do anything because of it. The only signal that can&#039;t be ignored or caught is SIGKILL(). The second is to have the signal set to its default state which means when the process receives it, the process will end. The last option is to catch the signal, when this occurs the unix system will give control to a function that will execute according to how appropriate it is for the process. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;kill()&#039;&#039;: The system sends a signal to the process when something occurs. It fails if the signal_name is not a correct signal. There is no process with the PID that matches the argument value.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;exit()&#039;&#039;: This call ends the process that calls it and returns the exit status value.&lt;br /&gt;
&lt;br /&gt;
In linux, all of these unix system calls have couterparts in linux except for the exec group of system calls, only execve exists. Also these system calls behave the same way in linux. However the system call &#039;&#039;signal()&#039;&#039; is not recommended to use because of its different implementations in different versions of linux and unix. It is better to use &#039;&#039;sigaction()&#039;&#039;. It changes the actions of the process when it receives a valid signal except SIGKILL and SIGSTOP. As newer versions of linux are released, these system calls will always never have major modifications but other system calls, based on these, may be created because specific cases which would make it easier to write programs.&lt;br /&gt;
&lt;br /&gt;
== Communications Calls==&lt;br /&gt;
&lt;br /&gt;
The communication calls relates to the concept of processes having the ability to communicate with one another. Similar to how humans use a telephone as their portal to communicate with eachother, communication calls use &amp;quot;pipes&amp;quot; as their gateway. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In unix there are four subgroups of system calls that are related to communications calls: pipelines, messages, semaphores, and shared memory.&lt;br /&gt;
The following are the system calls that belong to each of the subgroups.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pipelines: &#039;&#039;pipe()&#039;&#039; The pipe() command consists of two components. int pipe (file_descriptors) &amp;amp; int file_descriptors[2]. File_descriptors is an array consisting of two parts as well. One is for reading the data, and the other is for writing the data. Both writing and reading data will read in sequential order along with fully completing it&#039;s task. I.e.) There are no partial writes, the pipe will write the whole data that was sent and complete the transmission. The same concept holds for the reading where it will be read all the way through before reading another pipe or new information coming into the pipe. A specially named pipe is FIFO. Standing First In First Out. It is accessed as part of a file system through idea of pipes.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Messages: These functions all consist of recieving and sending messages from the queue usually involving ID&#039;s. &#039;&#039;msgget()&#039;&#039; acquires a message from the queue identifier relating to the key. Closely related, but not the same the &#039;&#039;msgrcv()&#039;&#039; command is used to recieve a message from the queue relating to the msqid parameter. This parameter involves the ID of where to recieve the message. &#039;&#039;msgsnd()&#039;&#039; sends a message to the queue. This command can be thought of as the reverse of the &#039;&#039;msgget()&#039;&#039;. Lastly, &#039;&#039;msgctl()&#039;&#039; performs message control operations through queries.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Semaphores: This idea of semaphores consists of setting it or checking it. They are used to control access to files. One can use the concept of file locking to get a better understanding of Semaphores. Semaphores aren&#039;t usually held together in singles, but rather in groups. This is done by creating a set that can contain several semaphores through the &#039;&#039;semget()&#039;&#039; command. &#039;&#039; semop()&#039;&#039; decides what we the semaphor to accomplish. I.e) depending on whether we have a positive, 0 or negative value, the semaphor shall be added, will wait, or be blocked until positive, respectively. Semaphores were first thought of by Dijkstra and used in computers in the late 60&#039;s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Shared Memory: Functions involving shared memory allow the user to be able to access, detach and combine shared addresses. &#039;&#039;shmget()&#039;&#039; command returns the ID for the shared memory region. It can also create it if it doesn&#039;t already exist. &#039;&#039;shmat()&#039;&#039; function attaches the  shared  memory  to the virtual address of the calling process. &#039;&#039;shmdt()&#039;&#039; reverses the &#039;&#039;shmat()&#039;&#039; command, and detaches shared memory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Unix and Linux use the same calls for the majority of the functions now, except for a few which are slighly different.&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous System Calls ==&lt;br /&gt;
This category of system calls contains the system calls that do not enough similar calls to form its own group. To avoid random calls floating around, we simply group them into this category. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Directories: These are special files that contain a number of filenames. There are different variations of directories, i.e.) System V, Berkely style directories. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Time: Intuitively, this call allows the user to access the time of day. Specifics on time can be obtained through the structure given by these attributes: &#039;&#039;tm_secint&#039;&#039;, &#039;&#039;tm_min&#039;&#039;, &#039;&#039;tm_hour&#039;&#039;, &#039;&#039;tm_mday&#039;&#039;, &#039;&#039;tm_mon&#039;&#039;, &#039;&#039; tm_year&#039;&#039;, just to list a few.&lt;br /&gt;
Parsing Input: Parsing is often used when the user enters in data and the program must parse this data into appropriate divisions in order to obtain specific parts of the data. I.e.)Seperate words from each other in the program, seperate numbers from characters. There are several different ways a programmer can parse the data in order to achieve specific pieces of the data that are needed to be analyzed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Lastly, there are some system calls which overlap and can be considered in a specific category or mentioned within the Miscellaneous System Calls. Referring to the ``3rd edition, Modern Operating Systems`` textbook, the command, ``chmod`` described above in File Management Calls is considered Miscellaneous. Similarly, the kill() command is mentioned as a Miscellaneous System Call. Hence, it is difficult to decifer whether a system call can be placed into a specific category or simply placed in the ``Other`` bin.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
System Calls have been an essential component to the structure of the Linux Kernel(2.6.30+) and Unix Operating Systems for a long period of time. They are the gateway between the user space and the kernel services. More specifically, it allows the User space to acquire the kernel services unlike processes which do not have this authority. Over the years of development in the Linux and Unix OS, the system calls have not had drastic changes to them. Rather than having radical changes to system calls, the development of system calls has merely added more specific system calls to solve new issues that occur within the OS. Hence, this concept has led the birth of 35 system calls to grow to an astonishing quantity consisting of hundreds of system calls. With hundreds of system calls available at ones disposable, all can be catgeorized into 6 major groups: file management, device management, information maintenance, process control, communications and miscellaneous calls. Operating Systems are a colossal program consisiting of very intrinsic pieces all coming together to form what we now know today as Linux Kernel(2.6.30+) or Unix. System calls are simply a small building block, but nevertheless an essential piece, to the tower that is our Operating System.&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
Salus, Peter H. A Quarter Century of Unix, Publisher: Addison-Wesly Professional, June 10, 1994.&lt;br /&gt;
&lt;br /&gt;
Unix Programming Manual, http://cm.bell-labs.com/cm/cs/who/dmr/1stEdman.html, November 3, 1971.&lt;br /&gt;
&lt;br /&gt;
BSD System Calls Manual. http://www.unix.com/man-page/FreeBSD/2/,  The Unix and Linux Forums.&lt;br /&gt;
&lt;br /&gt;
Linux Programmer&#039;s Manual, Linux man-pages project.&lt;br /&gt;
http://www.kernel.org/doc/man-pages/&lt;br /&gt;
&lt;br /&gt;
Mendonça Rato, Luís Miguel,professor,university of evora.  http://www.di.uevora.pt/~lmr/syscalls.html&lt;br /&gt;
&lt;br /&gt;
Tanenbaum, Andrew S. 3rd edition Modern Operating Systems.&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_1_2010_Question_2&amp;diff=4695</id>
		<title>COMP 3000 Essay 1 2010 Question 2</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_1_2010_Question_2&amp;diff=4695"/>
		<updated>2010-10-15T10:10:14Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: /* Device Management Calls */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Question=&lt;br /&gt;
How do the available system calls in modern versions of the Linux Kernel (2.6.30+) compare with the system calls available in the earliest versions of UNIX? How has the system call interface been expanded, and why? Focus on major changes or extensions in functionality.&lt;br /&gt;
&lt;br /&gt;
=Answer=&lt;br /&gt;
&lt;br /&gt;
A system call is a mean by which programs in the user space can access kernel services. Systems calls vary from operating system to operating system, although the underlying concepts tends to be the same. In general, a process is not supposed to be able to access the kernel directly. It can&#039;t access kernel memory and it can&#039;t call kernel functions. When the CPU prevents a process from accessing the kernel, this prevention is commonly known as, the protected mode. On the other hand, system calls are an exception to this rule. For example, older x86 processors used an interrupt mechanism to go from user-space to kernel-space, but newer processor (PentiumII+) provided instructions that optimize this transition using sysenter and sysexit instructions (Hayward, Mike. Intel P6 vs P7 system call performance. [http://lkml.org/lkml/2002/12/9/13], December 9, 2002).  All system calls are small programs built using the C programming language.&lt;br /&gt;
&lt;br /&gt;
The Unix and Linux systems calls are roughly grouped into 6 major categories: file management, device management, information maintenance, process control, communications and miscellaneous calls. The miscellaneous calls are all the ones that don’t really fit in the other categories, like system calls dealing with errors. Today, the Unix and Linux operating system contains hundreds of system calls but in general, they all came from the 35 system calls that came with one of the original UNIX OS in the early 70s. In the next paragraphs, we’re going to describe the various system calls in each of the categories mentioned above, their evolution through history (major changes in functionality) and a comparison with the earliest versions of UNIX.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== File Management Calls==&lt;br /&gt;
&lt;br /&gt;
The system calls in this group deal with every type of operation that is required to run a file system in the operating system. Create file, delete file, opening a file and closing a file are just a few examples of them and most of them hardly changed throughout the years. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;chmod&#039;&#039;, &#039;&#039;chown&#039;&#039; and &#039;&#039;chdir&#039;&#039; have been available since the first original UNIX (1971) and they are still used in today’s Linux kernels. The &#039;&#039;chmod&#039;&#039; and &#039;&#039;chown&#039;&#039; calls allows the users to change the file attributes and implements security to the file system. The system call &#039;&#039;chdir&#039;&#039; allows the process to change the current working directory. In the 4th distribution of UNIX from Berkeley (4BSD), new system calls were added to give more control of the file system to the applications. The call &#039;&#039;chroot&#039;&#039;  allows the process to change the current root directory with one specified in a path argument. &#039;&#039;fchmod&#039;&#039; and &#039;&#039;fchdir&#039;&#039; are the same as &#039;&#039;chmod&#039;&#039; and &#039;&#039;chdir&#039;&#039; except they takes file descriptors as arguments. As of Linux kernel 2.1.81, the &#039;&#039;chown&#039;&#039; system call now follows symbolic links and therefore, they introduced a new system call, &#039;&#039;lchown&#039;&#039;, that does not follow symbolic links.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another four of the original UNIX system calls are &#039;&#039;open&#039;&#039;, &#039;&#039;creat&#039;&#039;, &#039;&#039;mkdir&#039;&#039; and &#039;&#039;close&#039;&#039;. The &#039;&#039;open&#039;&#039; and &#039;&#039;creat&#039;&#039; calls allows processes to open and possibly create a file or device. Arguments flags are used to set from access modes, like O_RDONLY(read-only), to status flags, like O_APPEND(append mode). The only modifications made to the system calls were the addition of status flags where some of them are linux-specific. The &#039;&#039;close&#039;&#039; call allows processes to close a file descriptor preventing it to be reused. No changes were made to it. &#039;&#039;mkdir&#039;&#039; allows the creation of a file directory. In the earliest version of Unix, to delete a directory, users needed to make a series of &#039;&#039;link&#039;&#039; and &#039;&#039;unlink&#039;&#039; system calls. With Unix 4.2BSD, &#039;&#039;rmdir&#039;&#039; was added and helped solve the problem. The &#039;&#039;rename&#039;&#039; call was also added in 4.2BSD allowing processes to change the name or the location of a file. As file system became more complex, these new system calls helped the users gain better control over them.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is also system calls used to find, access and modify files. They are &#039;&#039;read&#039;&#039;, &#039;&#039;write&#039;&#039;, &#039;&#039;seek&#039;&#039; and &#039;&#039;stat&#039;&#039;. These were also part of the first UNIX built. The &#039;&#039;read&#039;&#039; and &#039;&#039;write&#039;&#039; system calls allows to read and write from a file (assigned to a file descriptor). The only change was in the Unix System V release 4(SVR4) where a &#039;&#039;write&#039;&#039; call could be interrupted at anytime. The &#039;&#039;seek&#039;&#039; system calls is used to go to a specified position in a file. This calls used a 16 bit address offset. But this was replaced very quickly for &#039;&#039;lseek&#039;&#039; as early as SVR4. It allows the call to use 32 bit address offsets enabling the users more flexibility when accessing or writing to files especially for large ones. It is still used in modern Linux and Unix systems. As of now, developers are trying to implement &#039;&#039;lseek64&#039;&#039;, a system call that will use 64 bit addresses. The &#039;&#039;stat&#039;&#039; system calls allows processes to get the status of a file. With SVR4, 2 other version of that system call were created: &#039;&#039;fstat&#039;&#039; and &#039;&#039;lstat&#039;&#039;. They both do the same thing except &#039;&#039;lstat&#039;&#039; give the status of symbolic links and &#039;&#039;fstat&#039;&#039; give the status of a file specified by a file descriptor. Different operating systems will output different values to represent the state of a file. Since kernel 2.5.48, the stat returned a nanoseconds field in the file’s timestamp. With the release of 4.4BSD, two new system calls called &#039;&#039;statvfs&#039;&#039; and &#039;&#039;fstatvfs&#039;&#039; were introduced to provide information about a mounted file system. They both do the same thing except fstatvfs takes file descriptors as an argument. These calls are only used in an UNIX environment. In Linux, it has &#039;&#039;statfs&#039;&#039; and &#039;&#039;fstatfs&#039;&#039; to support that same call.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last two original UNIX system calls in this category that are still used today are &#039;&#039;link&#039;&#039; and &#039;&#039;unlink&#039;&#039;. &#039;&#039;link&#039;&#039; creates a hard link to an existing file and &#039;&#039;unlink&#039;&#039; deletes a file link’s name and possibly the file it refers to. If the name refers to a symbolic link, only the link is removed. No major changes were done to the &#039;&#039;unlink&#039;&#039; system calls but new system calls were create from &#039;&#039;link&#039;&#039;. The &#039;&#039;symlink&#039;&#039; system call was added in 4.2BSD to allow the creation of symbolic links in the file system. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the Linux 2.6.16 build, multiple system calls were created so that the calls could deal with relative pathnames as arguments. They can easily be spotted as the system call names all finish with &#039;at&#039;. Here is a sample list of the created system calls: &#039;&#039;openat&#039;&#039;, &#039;&#039;mkdirat&#039;&#039;, &#039;&#039;fchmodat&#039;&#039;, &#039;&#039;fchownat&#039;&#039;, &#039;&#039;fstatat&#039;&#039;, &#039;&#039;linkat&#039;&#039;, &#039;&#039;unlinkat&#039;&#039;, &#039;&#039;renameat&#039;&#039; and &#039;&#039;fchmodat&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Device Management Calls==&lt;br /&gt;
&lt;br /&gt;
The device management system calls are linked to hardware and they are mainly used to requests for devices, release devices, to logically attach a device or to detach it, get and modified device attributes and read and write to them. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two of the most important system calls for the UNIX and Linux operating system is &#039;&#039;mount&#039;&#039; and &#039;&#039;umount&#039;&#039;. These were among the few system calls available in the first version of UNIX in 1971. The two calls allowed the operating system to load file systems on storage devices. A few changes were done to the mount system calls. Most of these changes were the creation of new mount flags to enhance performance. For example, since Linux 2.5.19, the MS_DIRSYNC flag permits the directory changes on a file system synchronous. Another Linux improvement was to provide per-process mount namespaces. This was added on the 2.4.19 kernel. If a process was created using the &#039;&#039;clone&#039;&#039; system call with the CLONE_NEWNS flag, the process will have a new namespace initialized to be a copy of the namespace of the process that was cloned. The &#039;&#039;umount&#039;&#039; system call unmounted the file system from the storage device. The only noteworthy change to &#039;&#039;umount&#039;&#039; was the creation of ‘‘umount2’’ in Linux 2.1.116. It is the same as &#039;&#039;umount&#039;&#039; except it allows different flags to control the operation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;open&#039;&#039;, &#039;&#039;read&#039;&#039; and &#039;&#039;write&#039;&#039; calls can also be used to access devices. As discussed in the previous section, arguments flags are used to better control the device. You would use them as if the devices were files using the appropriate flags.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With the SVR4 came the system call &#039;&#039;mmap&#039;&#039;. This system call is used to map or unmap files or devices into memory. Once a device is mapped, the system call returns a pointer to the mapped area allowing processes to access that device. This system call is still used in a Unix environment but since Linux 2.4, Linux replaced it by the mmap2 system call. It is basically the same as mmap except for a final argument specifying the offset into a file in 4096-byte units. This enables the mapping of large files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In version 7 of Unix, &#039;&#039;ioctl&#039;&#039; system call is used for device-specific operations that can’t be done using the standard system calls. This helps to deal with a multitude of devices. Each device drivers would provide a set of ioctl request code to allow various operations on their device. Each various request code are hardware dependent so there is no standard available for this system call.&lt;br /&gt;
&lt;br /&gt;
== Information Maintenance Calls==&lt;br /&gt;
Information maintenance calls are system calls that return the computers personal information back to the user or change it completely. These type of calls can be split up into three groups get/set time or date, get/set system data and get/set process, file, or device attributes. To fully understand the difference between Linux and UNIX in regrades to system calls, one must explore the three sub-types of information maintenance calls and see how they have changed over time.&lt;br /&gt;
&lt;br /&gt;
The first sub type is Get/set of time and/or date. In Linux, this can be done by a few different system calls, there are: &#039;gettimeofday&#039; to get the time, &#039;settimeofday&#039; to set it, &#039;time&#039; returns the time in seconds and a few other ones like &#039;ftime&#039;.In the earliest versions UNIX the used the system call was &#039;stime&#039;, which was used to  interact with time and dates. &#039;stime&#039; could return the time and date and sets the system’s idea of the time and date by altering the seconds. &#039;stime&#039; is still being used by Linux because it is successful, unlike &#039;settimeofday&#039;, which was created to change timezones (tz_dsttime) as well as the time but each occurrence of this field call in the kernel source (apart from declaration) is a bug thus failing. &lt;br /&gt;
&lt;br /&gt;
The second sub type is get/set system data. UNIX does this using the following commands: &#039;open&#039;, &#039;read&#039;, &#039;close&#039;, and &#039;write&#039;. &#039;open&#039; opens a file so the file can be written to or read from. &#039;read&#039; retrieves data from the file, and &#039;write&#039; modifies data in the file. &#039;close&#039; is used to indicate that the file is no longer in use. Linux uses the same set of commands for the same purposes.In addition to those system calls there Linux has there own unique system calls which are: &#039;olduname&#039; gets name and information about current kernel, similar to that is &#039;uname&#039; gets name and information about current kernel (which is used in the newer versions of UNIX not the older ones), &#039;iopl&#039; which changes I/O privilege level and &#039;sysfs&#039; which gets file system type information.&lt;br /&gt;
&lt;br /&gt;
The third sub type is get/set process, file, or device attributes, in UNIX there are several system calls for processing file and device attributes, some of these examples are common to both UNIX and Linux: &#039;stat&#039; gets file status, &#039;fork&#039; which spawns a new process, and &#039;stty&#039; which sets the mode of typewriter.The &#039;wait&#039; system call is used in both as well the only really difference is that in the Linux version wait store status information in a integer which take the integer itself as an argument, not a pointer to itself. In Linux there are a lot more system calls regarding this type and here are a few of them: &#039;capget&#039; gets the capabilities of the process, &#039;capset&#039; sets the capabilities process, &#039;getppid&#039; gets process identification. The &#039;capget&#039; and &#039;capset&#039; interact with the raw kernel interface to getting and setting thread capabilities. These two system calls are specific to Linux and as such the use of these functions (in particular the format of the cap_user_*_t types) are updated as the kernel is updated. The &#039;getppid&#039; returns the process ID of the calling process and never has any errors.&lt;br /&gt;
&lt;br /&gt;
== Process Control Calls==&lt;br /&gt;
&lt;br /&gt;
Process Control calls are system calls that handle the start, termination and other tasks that might be required &lt;br /&gt;
for a process to run correctly.&lt;br /&gt;
&lt;br /&gt;
In unix there are 10 system calls that make up Process Control Calls. These are:&lt;br /&gt;
&#039;&#039;fork()&#039;&#039;,&#039;&#039;wait()&#039;&#039;,&#039;&#039;execl()&#039;&#039;,&#039;&#039;execlp()&#039;&#039;,&#039;&#039;execle()&#039;&#039;,&#039;&#039;execvp()&#039;&#039;,&#039;&#039;execv()&#039;&#039;,&#039;&#039;execve()&#039;&#039;,&#039;&#039;exit()&#039;&#039;,&#039;&#039;signal()&#039;&#039;,&#039;&#039;kill()&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;fork()&#039;&#039;: It takes a process and creates an identical processes, which in turn makes one the parent process and the &lt;br /&gt;
other the child process. When &#039;&#039;fork()&#039;&#039; succeds it returns 0 to the child process and returns the PID of the child process to the parent process. When it fails, &#039;&#039;fork()&#039;&#039; returns -1 to the parent process.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;wait()&#039;&#039;: This call makes a parent process wait for the child process to end. It returns the pid of the child process that is &lt;br /&gt;
done. Wait fails if the process has no child process to wait for or its points to an invalid address.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;execl()&#039;&#039;,&#039;&#039;execlp()&#039;&#039;,&#039;&#039;execle()&#039;&#039;,&#039;&#039;execvp()&#039;&#039;,&#039;&#039;execv()&#039;&#039;, are system calls based on the same principle that the system call &lt;br /&gt;
takes as an argument a binary file and converts it into a process. When the system call works properly it does &lt;br /&gt;
not return, instead it gives control to the new process which replaces the process that called the system call.&lt;br /&gt;
each of these are called when different arguments are given.&lt;br /&gt;
&lt;br /&gt;
The following are the definitions for the these system calls as described by this [http://www.di.uevora.pt/~lmr/syscalls.html]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;execl()&#039;&#039;: Takes the path name of an executable program (binary file) as its first argument.  The rest of the arguments are a list of command&lt;br /&gt;
line arguments to the new program (argv[]).  The list terminated with a null pointer&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;execle()&#039;&#039;: Same as execl(), except that the end of the argument list is followed by a pointer to a null-terminated list of character&lt;br /&gt;
pointers that is passed a the environment of the new program&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;execv()&#039;&#039;: Takes the path name of an executable program (binary file) as it first argument.  The second argument is a pointer to a list of&lt;br /&gt;
character pointers (like argv[]) that is passed as command line arguments to the new program.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;execve()&#039;&#039;: Same as execv(), except that a third argument is given as a pointer to a list of character pointers (like argv[]) that is passed as the environment of the new program.&lt;br /&gt;
       &lt;br /&gt;
&#039;&#039;execlp()&#039;&#039;: Same as execl(), except that the program name doesn&#039;t have to be a full path name, and it can be a shell program instead of executable module.&lt;br /&gt;
&#039;&#039;execvp()&#039;&#039;: Same as execv(), except that the program name doesn&#039;t have to be a full path name, and it can be a shell program instead of an executable module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;signal()&#039;&#039;: This system call is sent to the process when the proper conditions are met. When the program receives the signal it can act in three different ways. The first is to ignore completely, it wont matter how many times the signal is sent the process will not do anything because of it. The only signal that can&#039;t be ignored or caught is SIGKILL(). The second is to have the signal set to its default state which means when the process receives it, the process will end. The last option is to catch the signal, when this occurs the unix system will give control to a function that will execute according to how appropriate it is for the process. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;kill()&#039;&#039;: The system sends a signal to the process when something occurs. It fails if the signal_name is not a correct signal. There is no process with the PID that matches the argument value.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;exit()&#039;&#039;: This call ends the process that calls it and returns the exit status value.&lt;br /&gt;
&lt;br /&gt;
In linux, all of these unix system calls have couterparts in linux except for the exec group of system calls, only execve exists. Also these system calls behave the same way in linux. However the system call &#039;&#039;signal()&#039;&#039; is not recommended to use because of its different implementations in different versions of linux and unix. It is better to use &#039;&#039;sigaction()&#039;&#039;. It changes the actions of the process when it receives a valid signal except SIGKILL and SIGSTOP. As newer versions of linux are released, these system calls will always never have major modifications but other system calls, based on these, may be created because specific cases which would make it easier to write programs.&lt;br /&gt;
&lt;br /&gt;
== Communications Calls==&lt;br /&gt;
&lt;br /&gt;
The communication calls relates to the concept of processes having the ability to communicate with one another. Similar to how humans use a telephone as their portal to communicate with eachother, communication calls use &amp;quot;pipes&amp;quot; as their gateway. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In unix there are four subgroups of system calls that are related to communications calls: pipelines, messages, semaphores, and shared memory.&lt;br /&gt;
The following are the system calls that belong to each of the subgroups.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pipelines: &#039;&#039;pipe()&#039;&#039; The pipe() command consists of two components. int pipe (file_descriptors) &amp;amp; int file_descriptors[2]. File_descriptors is an array consisting of two parts as well. One is for reading the data, and the other is for writing the data. Both writing and reading data will read in sequential order along with fully completing it&#039;s task. I.e.) There are no partial writes, the pipe will write the whole data that was sent and complete the transmission. The same concept holds for the reading where it will be read all the way through before reading another pipe or new information coming into the pipe. A specially named pipe is FIFO. Standing First In First Out. It is accessed as part of a file system through idea of pipes.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Messages: These functions all consist of recieving and sending messages from the queue usually involving ID&#039;s. &#039;&#039;msgget()&#039;&#039; acquires a message from the queue identifier relating to the key. Closely related, but not the same the &#039;&#039;msgrcv()&#039;&#039; command is used to recieve a message from the queue relating to the msqid parameter. This parameter involves the ID of where to recieve the message. &#039;&#039;msgsnd()&#039;&#039; sends a message to the queue. This command can be thought of as the reverse of the &#039;&#039;msgget()&#039;&#039;. Lastly, &#039;&#039;msgctl()&#039;&#039; performs message control operations through queries.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Semaphores: This idea of semaphores consists of setting it or checking it. They are used to control access to files. One can use the concept of file locking to get a better understanding of Semaphores. Semaphores aren&#039;t usually held together in singles, but rather in groups. This is done by creating a set that can contain several semaphores through the &#039;&#039;semget()&#039;&#039; command. &#039;&#039; semop()&#039;&#039; decides what we the semaphor to accomplish. I.e) depending on whether we have a positive, 0 or negative value, the semaphor shall be added, will wait, or be blocked until positive, respectively. Semaphores were first thought of by Dijkstra and used in computers in the late 60&#039;s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Shared Memory: Functions involving shared memory allow the user to be able to access, detach and combine shared addresses. &#039;&#039;shmget()&#039;&#039; command returns the ID for the shared memory region. It can also create it if it doesn&#039;t already exist. &#039;&#039;shmat()&#039;&#039; function attaches the  shared  memory  to the virtual address of the calling process. &#039;&#039;shmdt()&#039;&#039; reverses the &#039;&#039;shmat()&#039;&#039; command, and detaches shared memory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Unix and Linux use the same calls for the majority of the functions now, except for a few which are slighly different.&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous System Calls ==&lt;br /&gt;
This category of system calls contains the system calls that do not enough similar calls to form its own group. To avoid random calls floating around, we simply group them into this category. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Directories: These are special files that contain a number of filenames. There are different variations of directories, i.e.) System V, Berkely style directories. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Time: Intuitively, this call allows the user to access the time of day. Specifics on time can be obtained through the structure given by these attributes: &#039;&#039;tm_secint&#039;&#039;, &#039;&#039;tm_min&#039;&#039;, &#039;&#039;tm_hour&#039;&#039;, &#039;&#039;tm_mday&#039;&#039;, &#039;&#039;tm_mon&#039;&#039;, &#039;&#039; tm_year&#039;&#039;, just to list a few.&lt;br /&gt;
Parsing Input: Parsing is often used when the user enters in data and the program must parse this data into appropriate divisions in order to obtain specific parts of the data. I.e.)Seperate words from each other in the program, seperate numbers from characters. There are several different ways a programmer can parse the data in order to achieve specific pieces of the data that are needed to be analyzed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Lastly, there are some system calls which overlap and can be considered in a specific category or mentioned within the Miscellaneous System Calls. Referring to the ``3rd edition, Modern Operating Systems`` textbook, the command, ``chmod`` described above in File Management Calls is considered Miscellaneous. Similarly, the kill() command is mentioned as a Miscellaneous System Call. Hence, it is difficult to decifer whether a system call can be placed into a specific category or simply placed in the ``Other`` bin.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
System Calls have been an essential component to the structure of the Linux Kernel(2.6.30+) and Unix Operating Systems for a long period of time. They are the gateway between the user space and the kernel services. More specifically, it allows the User space to acquire the kernel services unlike processes which do not have this authority. Over the years of development in the Linux and Unix OS, the system calls have not had drastic changes to them. Rather than having radical changes to system calls, the development of system calls has merely added more specific system calls to solve new issues that occur within the OS. Hence, this concept has led the birth of 35 system calls to grow to an astonishing quantity consisting of hundreds of system calls. With hundreds of system calls available at ones disposable, all can be catgeorized into 6 major groups: file management, device management, information maintenance, process control, communications and miscellaneous calls. Operating Systems are a colossal program consisiting of very intrinsic pieces all coming together to form what we now know today as Linux Kernel(2.6.30+) or Unix. System calls are simply a small building block, but nevertheless an essential piece, to the tower that is our Operating System.&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
Salus, Peter H. A Quarter Century of Unix, Publisher: Addison-Wesly Professional, June 10, 1994.&lt;br /&gt;
&lt;br /&gt;
Unix Programming Manual, http://cm.bell-labs.com/cm/cs/who/dmr/1stEdman.html, November 3, 1971.&lt;br /&gt;
&lt;br /&gt;
BSD System Calls Manual. http://www.unix.com/man-page/FreeBSD/2/,  The Unix and Linux Forums.&lt;br /&gt;
&lt;br /&gt;
Linux Programmer&#039;s Manual, Linux man-pages project.&lt;br /&gt;
http://www.kernel.org/doc/man-pages/&lt;br /&gt;
&lt;br /&gt;
Mendonça Rato, Luís Miguel,professor,university of evora.  http://www.di.uevora.pt/~lmr/syscalls.html&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_1_2010_Question_2&amp;diff=4694</id>
		<title>COMP 3000 Essay 1 2010 Question 2</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_1_2010_Question_2&amp;diff=4694"/>
		<updated>2010-10-15T10:08:03Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: /* File Management Calls */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Question=&lt;br /&gt;
How do the available system calls in modern versions of the Linux Kernel (2.6.30+) compare with the system calls available in the earliest versions of UNIX? How has the system call interface been expanded, and why? Focus on major changes or extensions in functionality.&lt;br /&gt;
&lt;br /&gt;
=Answer=&lt;br /&gt;
&lt;br /&gt;
A system call is a mean by which programs in the user space can access kernel services. Systems calls vary from operating system to operating system, although the underlying concepts tends to be the same. In general, a process is not supposed to be able to access the kernel directly. It can&#039;t access kernel memory and it can&#039;t call kernel functions. When the CPU prevents a process from accessing the kernel, this prevention is commonly known as, the protected mode. On the other hand, system calls are an exception to this rule. For example, older x86 processors used an interrupt mechanism to go from user-space to kernel-space, but newer processor (PentiumII+) provided instructions that optimize this transition using sysenter and sysexit instructions (Hayward, Mike. Intel P6 vs P7 system call performance. [http://lkml.org/lkml/2002/12/9/13], December 9, 2002).  All system calls are small programs built using the C programming language.&lt;br /&gt;
&lt;br /&gt;
The Unix and Linux systems calls are roughly grouped into 6 major categories: file management, device management, information maintenance, process control, communications and miscellaneous calls. The miscellaneous calls are all the ones that don’t really fit in the other categories, like system calls dealing with errors. Today, the Unix and Linux operating system contains hundreds of system calls but in general, they all came from the 35 system calls that came with one of the original UNIX OS in the early 70s. In the next paragraphs, we’re going to describe the various system calls in each of the categories mentioned above, their evolution through history (major changes in functionality) and a comparison with the earliest versions of UNIX.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== File Management Calls==&lt;br /&gt;
&lt;br /&gt;
The system calls in this group deal with every type of operation that is required to run a file system in the operating system. Create file, delete file, opening a file and closing a file are just a few examples of them and most of them hardly changed throughout the years. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;chmod&#039;&#039;, &#039;&#039;chown&#039;&#039; and &#039;&#039;chdir&#039;&#039; have been available since the first original UNIX (1971) and they are still used in today’s Linux kernels. The &#039;&#039;chmod&#039;&#039; and &#039;&#039;chown&#039;&#039; calls allows the users to change the file attributes and implements security to the file system. The system call &#039;&#039;chdir&#039;&#039; allows the process to change the current working directory. In the 4th distribution of UNIX from Berkeley (4BSD), new system calls were added to give more control of the file system to the applications. The call &#039;&#039;chroot&#039;&#039;  allows the process to change the current root directory with one specified in a path argument. &#039;&#039;fchmod&#039;&#039; and &#039;&#039;fchdir&#039;&#039; are the same as &#039;&#039;chmod&#039;&#039; and &#039;&#039;chdir&#039;&#039; except they takes file descriptors as arguments. As of Linux kernel 2.1.81, the &#039;&#039;chown&#039;&#039; system call now follows symbolic links and therefore, they introduced a new system call, &#039;&#039;lchown&#039;&#039;, that does not follow symbolic links.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another four of the original UNIX system calls are &#039;&#039;open&#039;&#039;, &#039;&#039;creat&#039;&#039;, &#039;&#039;mkdir&#039;&#039; and &#039;&#039;close&#039;&#039;. The &#039;&#039;open&#039;&#039; and &#039;&#039;creat&#039;&#039; calls allows processes to open and possibly create a file or device. Arguments flags are used to set from access modes, like O_RDONLY(read-only), to status flags, like O_APPEND(append mode). The only modifications made to the system calls were the addition of status flags where some of them are linux-specific. The &#039;&#039;close&#039;&#039; call allows processes to close a file descriptor preventing it to be reused. No changes were made to it. &#039;&#039;mkdir&#039;&#039; allows the creation of a file directory. In the earliest version of Unix, to delete a directory, users needed to make a series of &#039;&#039;link&#039;&#039; and &#039;&#039;unlink&#039;&#039; system calls. With Unix 4.2BSD, &#039;&#039;rmdir&#039;&#039; was added and helped solve the problem. The &#039;&#039;rename&#039;&#039; call was also added in 4.2BSD allowing processes to change the name or the location of a file. As file system became more complex, these new system calls helped the users gain better control over them.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is also system calls used to find, access and modify files. They are &#039;&#039;read&#039;&#039;, &#039;&#039;write&#039;&#039;, &#039;&#039;seek&#039;&#039; and &#039;&#039;stat&#039;&#039;. These were also part of the first UNIX built. The &#039;&#039;read&#039;&#039; and &#039;&#039;write&#039;&#039; system calls allows to read and write from a file (assigned to a file descriptor). The only change was in the Unix System V release 4(SVR4) where a &#039;&#039;write&#039;&#039; call could be interrupted at anytime. The &#039;&#039;seek&#039;&#039; system calls is used to go to a specified position in a file. This calls used a 16 bit address offset. But this was replaced very quickly for &#039;&#039;lseek&#039;&#039; as early as SVR4. It allows the call to use 32 bit address offsets enabling the users more flexibility when accessing or writing to files especially for large ones. It is still used in modern Linux and Unix systems. As of now, developers are trying to implement &#039;&#039;lseek64&#039;&#039;, a system call that will use 64 bit addresses. The &#039;&#039;stat&#039;&#039; system calls allows processes to get the status of a file. With SVR4, 2 other version of that system call were created: &#039;&#039;fstat&#039;&#039; and &#039;&#039;lstat&#039;&#039;. They both do the same thing except &#039;&#039;lstat&#039;&#039; give the status of symbolic links and &#039;&#039;fstat&#039;&#039; give the status of a file specified by a file descriptor. Different operating systems will output different values to represent the state of a file. Since kernel 2.5.48, the stat returned a nanoseconds field in the file’s timestamp. With the release of 4.4BSD, two new system calls called &#039;&#039;statvfs&#039;&#039; and &#039;&#039;fstatvfs&#039;&#039; were introduced to provide information about a mounted file system. They both do the same thing except fstatvfs takes file descriptors as an argument. These calls are only used in an UNIX environment. In Linux, it has &#039;&#039;statfs&#039;&#039; and &#039;&#039;fstatfs&#039;&#039; to support that same call.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last two original UNIX system calls in this category that are still used today are &#039;&#039;link&#039;&#039; and &#039;&#039;unlink&#039;&#039;. &#039;&#039;link&#039;&#039; creates a hard link to an existing file and &#039;&#039;unlink&#039;&#039; deletes a file link’s name and possibly the file it refers to. If the name refers to a symbolic link, only the link is removed. No major changes were done to the &#039;&#039;unlink&#039;&#039; system calls but new system calls were create from &#039;&#039;link&#039;&#039;. The &#039;&#039;symlink&#039;&#039; system call was added in 4.2BSD to allow the creation of symbolic links in the file system. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the Linux 2.6.16 build, multiple system calls were created so that the calls could deal with relative pathnames as arguments. They can easily be spotted as the system call names all finish with &#039;at&#039;. Here is a sample list of the created system calls: &#039;&#039;openat&#039;&#039;, &#039;&#039;mkdirat&#039;&#039;, &#039;&#039;fchmodat&#039;&#039;, &#039;&#039;fchownat&#039;&#039;, &#039;&#039;fstatat&#039;&#039;, &#039;&#039;linkat&#039;&#039;, &#039;&#039;unlinkat&#039;&#039;, &#039;&#039;renameat&#039;&#039; and &#039;&#039;fchmodat&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Device Management Calls==&lt;br /&gt;
&lt;br /&gt;
The device management system calls are linked to hardware and they are mainly used to requests for devices, release devices, to logically attach a device or to detach it, get and modified device attributes and read and write to them. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two of the most important system calls for the UNIX and Linux operating system is ‘‘mount’’ and ‘‘umount’’. These were among the few system calls available in the first version of UNIX in 1971. The two calls allowed the operating system to load file systems on storage devices. A few changes were done to the mount system calls. Most of these changes were the creation of new mount flags to enhance performance. For example, since Linux 2.5.19, the MS_DIRSYNC flag permits the directory changes on a file system synchronous. Another Linux improvement was to provide per-process mount namespaces. This was added on the 2.4.19 kernel. If a process was created using clone() with the CLONE_NEWNS flag, the process will have a new namespace initialized to be a copy of the namespace of the process that was cloned. The ‘‘umount’’ system call unmounted the file system from the storage device. The only noteworthy change to ‘‘umount’’ was the creation of ‘‘umount2’’ in Linux 2.1.116. It is the same as ‘‘umount’’ except it allows different flags to control the operation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The ‘‘open’’, ‘‘read’’ and ‘‘write’’ calls can also be used to access devices. As discussed in the previous section, arguments flags are used to better control the device. You would use them as if the devices were files using the appropriate flags.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With the SVR4 came the system call ‘‘mmap’’. This system call is used to map or unmap files or devices into memory. Once a device is mapped, the system call returns a pointer to the mapped area allowing processes to access that device. This system call is still used in a Unix environment but since Linux 2.4, Linux replaced it by the mmap2 system call. It is basically the same as mmap except for a final argument specifying the offset into a file in 4096-byte units. This enables the mapping of large files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In version 7 of Unix, ‘‘ioctl’’ system call is used for device-specific operations that can’t be done using the standard system calls. This helps to deal with a multitude of devices. Each device drivers would provide a set of ioctl request code to allow various operations on their device. Each various request code are hardware dependent so there is no standard available for this system call.&lt;br /&gt;
&lt;br /&gt;
== Information Maintenance Calls==&lt;br /&gt;
Information maintenance calls are system calls that return the computers personal information back to the user or change it completely. These type of calls can be split up into three groups get/set time or date, get/set system data and get/set process, file, or device attributes. To fully understand the difference between Linux and UNIX in regrades to system calls, one must explore the three sub-types of information maintenance calls and see how they have changed over time.&lt;br /&gt;
&lt;br /&gt;
The first sub type is Get/set of time and/or date. In Linux, this can be done by a few different system calls, there are: &#039;gettimeofday&#039; to get the time, &#039;settimeofday&#039; to set it, &#039;time&#039; returns the time in seconds and a few other ones like &#039;ftime&#039;.In the earliest versions UNIX the used the system call was &#039;stime&#039;, which was used to  interact with time and dates. &#039;stime&#039; could return the time and date and sets the system’s idea of the time and date by altering the seconds. &#039;stime&#039; is still being used by Linux because it is successful, unlike &#039;settimeofday&#039;, which was created to change timezones (tz_dsttime) as well as the time but each occurrence of this field call in the kernel source (apart from declaration) is a bug thus failing. &lt;br /&gt;
&lt;br /&gt;
The second sub type is get/set system data. UNIX does this using the following commands: &#039;open&#039;, &#039;read&#039;, &#039;close&#039;, and &#039;write&#039;. &#039;open&#039; opens a file so the file can be written to or read from. &#039;read&#039; retrieves data from the file, and &#039;write&#039; modifies data in the file. &#039;close&#039; is used to indicate that the file is no longer in use. Linux uses the same set of commands for the same purposes.In addition to those system calls there Linux has there own unique system calls which are: &#039;olduname&#039; gets name and information about current kernel, similar to that is &#039;uname&#039; gets name and information about current kernel (which is used in the newer versions of UNIX not the older ones), &#039;iopl&#039; which changes I/O privilege level and &#039;sysfs&#039; which gets file system type information.&lt;br /&gt;
&lt;br /&gt;
The third sub type is get/set process, file, or device attributes, in UNIX there are several system calls for processing file and device attributes, some of these examples are common to both UNIX and Linux: &#039;stat&#039; gets file status, &#039;fork&#039; which spawns a new process, and &#039;stty&#039; which sets the mode of typewriter.The &#039;wait&#039; system call is used in both as well the only really difference is that in the Linux version wait store status information in a integer which take the integer itself as an argument, not a pointer to itself. In Linux there are a lot more system calls regarding this type and here are a few of them: &#039;capget&#039; gets the capabilities of the process, &#039;capset&#039; sets the capabilities process, &#039;getppid&#039; gets process identification. The &#039;capget&#039; and &#039;capset&#039; interact with the raw kernel interface to getting and setting thread capabilities. These two system calls are specific to Linux and as such the use of these functions (in particular the format of the cap_user_*_t types) are updated as the kernel is updated. The &#039;getppid&#039; returns the process ID of the calling process and never has any errors.&lt;br /&gt;
&lt;br /&gt;
== Process Control Calls==&lt;br /&gt;
&lt;br /&gt;
Process Control calls are system calls that handle the start, termination and other tasks that might be required &lt;br /&gt;
for a process to run correctly.&lt;br /&gt;
&lt;br /&gt;
In unix there are 10 system calls that make up Process Control Calls. These are:&lt;br /&gt;
&#039;&#039;fork()&#039;&#039;,&#039;&#039;wait()&#039;&#039;,&#039;&#039;execl()&#039;&#039;,&#039;&#039;execlp()&#039;&#039;,&#039;&#039;execle()&#039;&#039;,&#039;&#039;execvp()&#039;&#039;,&#039;&#039;execv()&#039;&#039;,&#039;&#039;execve()&#039;&#039;,&#039;&#039;exit()&#039;&#039;,&#039;&#039;signal()&#039;&#039;,&#039;&#039;kill()&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;fork()&#039;&#039;: It takes a process and creates an identical processes, which in turn makes one the parent process and the &lt;br /&gt;
other the child process. When &#039;&#039;fork()&#039;&#039; succeds it returns 0 to the child process and returns the PID of the child process to the parent process. When it fails, &#039;&#039;fork()&#039;&#039; returns -1 to the parent process.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;wait()&#039;&#039;: This call makes a parent process wait for the child process to end. It returns the pid of the child process that is &lt;br /&gt;
done. Wait fails if the process has no child process to wait for or its points to an invalid address.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;execl()&#039;&#039;,&#039;&#039;execlp()&#039;&#039;,&#039;&#039;execle()&#039;&#039;,&#039;&#039;execvp()&#039;&#039;,&#039;&#039;execv()&#039;&#039;, are system calls based on the same principle that the system call &lt;br /&gt;
takes as an argument a binary file and converts it into a process. When the system call works properly it does &lt;br /&gt;
not return, instead it gives control to the new process which replaces the process that called the system call.&lt;br /&gt;
each of these are called when different arguments are given.&lt;br /&gt;
&lt;br /&gt;
The following are the definitions for the these system calls as described by this [http://www.di.uevora.pt/~lmr/syscalls.html]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;execl()&#039;&#039;: Takes the path name of an executable program (binary file) as its first argument.  The rest of the arguments are a list of command&lt;br /&gt;
line arguments to the new program (argv[]).  The list terminated with a null pointer&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;execle()&#039;&#039;: Same as execl(), except that the end of the argument list is followed by a pointer to a null-terminated list of character&lt;br /&gt;
pointers that is passed a the environment of the new program&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;execv()&#039;&#039;: Takes the path name of an executable program (binary file) as it first argument.  The second argument is a pointer to a list of&lt;br /&gt;
character pointers (like argv[]) that is passed as command line arguments to the new program.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;execve()&#039;&#039;: Same as execv(), except that a third argument is given as a pointer to a list of character pointers (like argv[]) that is passed as the environment of the new program.&lt;br /&gt;
       &lt;br /&gt;
&#039;&#039;execlp()&#039;&#039;: Same as execl(), except that the program name doesn&#039;t have to be a full path name, and it can be a shell program instead of executable module.&lt;br /&gt;
&#039;&#039;execvp()&#039;&#039;: Same as execv(), except that the program name doesn&#039;t have to be a full path name, and it can be a shell program instead of an executable module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;signal()&#039;&#039;: This system call is sent to the process when the proper conditions are met. When the program receives the signal it can act in three different ways. The first is to ignore completely, it wont matter how many times the signal is sent the process will not do anything because of it. The only signal that can&#039;t be ignored or caught is SIGKILL(). The second is to have the signal set to its default state which means when the process receives it, the process will end. The last option is to catch the signal, when this occurs the unix system will give control to a function that will execute according to how appropriate it is for the process. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;kill()&#039;&#039;: The system sends a signal to the process when something occurs. It fails if the signal_name is not a correct signal. There is no process with the PID that matches the argument value.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;exit()&#039;&#039;: This call ends the process that calls it and returns the exit status value.&lt;br /&gt;
&lt;br /&gt;
In linux, all of these unix system calls have couterparts in linux except for the exec group of system calls, only execve exists. Also these system calls behave the same way in linux. However the system call &#039;&#039;signal()&#039;&#039; is not recommended to use because of its different implementations in different versions of linux and unix. It is better to use &#039;&#039;sigaction()&#039;&#039;. It changes the actions of the process when it receives a valid signal except SIGKILL and SIGSTOP. As newer versions of linux are released, these system calls will always never have major modifications but other system calls, based on these, may be created because specific cases which would make it easier to write programs.&lt;br /&gt;
&lt;br /&gt;
== Communications Calls==&lt;br /&gt;
&lt;br /&gt;
The communication calls relates to the concept of processes having the ability to communicate with one another. Similar to how humans use a telephone as their portal to communicate with eachother, communication calls use &amp;quot;pipes&amp;quot; as their gateway. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In unix there are four subgroups of system calls that are related to communications calls: pipelines, messages, semaphores, and shared memory.&lt;br /&gt;
The following are the system calls that belong to each of the subgroups.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pipelines: &#039;&#039;pipe()&#039;&#039; The pipe() command consists of two components. int pipe (file_descriptors) &amp;amp; int file_descriptors[2]. File_descriptors is an array consisting of two parts as well. One is for reading the data, and the other is for writing the data. Both writing and reading data will read in sequential order along with fully completing it&#039;s task. I.e.) There are no partial writes, the pipe will write the whole data that was sent and complete the transmission. The same concept holds for the reading where it will be read all the way through before reading another pipe or new information coming into the pipe. A specially named pipe is FIFO. Standing First In First Out. It is accessed as part of a file system through idea of pipes.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Messages: These functions all consist of recieving and sending messages from the queue usually involving ID&#039;s. &#039;&#039;msgget()&#039;&#039; acquires a message from the queue identifier relating to the key. Closely related, but not the same the &#039;&#039;msgrcv()&#039;&#039; command is used to recieve a message from the queue relating to the msqid parameter. This parameter involves the ID of where to recieve the message. &#039;&#039;msgsnd()&#039;&#039; sends a message to the queue. This command can be thought of as the reverse of the &#039;&#039;msgget()&#039;&#039;. Lastly, &#039;&#039;msgctl()&#039;&#039; performs message control operations through queries.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Semaphores: This idea of semaphores consists of setting it or checking it. They are used to control access to files. One can use the concept of file locking to get a better understanding of Semaphores. Semaphores aren&#039;t usually held together in singles, but rather in groups. This is done by creating a set that can contain several semaphores through the &#039;&#039;semget()&#039;&#039; command. &#039;&#039; semop()&#039;&#039; decides what we the semaphor to accomplish. I.e) depending on whether we have a positive, 0 or negative value, the semaphor shall be added, will wait, or be blocked until positive, respectively. Semaphores were first thought of by Dijkstra and used in computers in the late 60&#039;s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Shared Memory: Functions involving shared memory allow the user to be able to access, detach and combine shared addresses. &#039;&#039;shmget()&#039;&#039; command returns the ID for the shared memory region. It can also create it if it doesn&#039;t already exist. &#039;&#039;shmat()&#039;&#039; function attaches the  shared  memory  to the virtual address of the calling process. &#039;&#039;shmdt()&#039;&#039; reverses the &#039;&#039;shmat()&#039;&#039; command, and detaches shared memory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Unix and Linux use the same calls for the majority of the functions now, except for a few which are slighly different.&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous System Calls ==&lt;br /&gt;
This category of system calls contains the system calls that do not enough similar calls to form its own group. To avoid random calls floating around, we simply group them into this category. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Directories: These are special files that contain a number of filenames. There are different variations of directories, i.e.) System V, Berkely style directories. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Time: Intuitively, this call allows the user to access the time of day. Specifics on time can be obtained through the structure given by these attributes: &#039;&#039;tm_secint&#039;&#039;, &#039;&#039;tm_min&#039;&#039;, &#039;&#039;tm_hour&#039;&#039;, &#039;&#039;tm_mday&#039;&#039;, &#039;&#039;tm_mon&#039;&#039;, &#039;&#039; tm_year&#039;&#039;, just to list a few.&lt;br /&gt;
Parsing Input: Parsing is often used when the user enters in data and the program must parse this data into appropriate divisions in order to obtain specific parts of the data. I.e.)Seperate words from each other in the program, seperate numbers from characters. There are several different ways a programmer can parse the data in order to achieve specific pieces of the data that are needed to be analyzed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Lastly, there are some system calls which overlap and can be considered in a specific category or mentioned within the Miscellaneous System Calls. Referring to the ``3rd edition, Modern Operating Systems`` textbook, the command, ``chmod`` described above in File Management Calls is considered Miscellaneous. Similarly, the kill() command is mentioned as a Miscellaneous System Call. Hence, it is difficult to decifer whether a system call can be placed into a specific category or simply placed in the ``Other`` bin.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
System Calls have been an essential component to the structure of the Linux Kernel(2.6.30+) and Unix Operating Systems for a long period of time. They are the gateway between the user space and the kernel services. More specifically, it allows the User space to acquire the kernel services unlike processes which do not have this authority. Over the years of development in the Linux and Unix OS, the system calls have not had drastic changes to them. Rather than having radical changes to system calls, the development of system calls has merely added more specific system calls to solve new issues that occur within the OS. Hence, this concept has led the birth of 35 system calls to grow to an astonishing quantity consisting of hundreds of system calls. With hundreds of system calls available at ones disposable, all can be catgeorized into 6 major groups: file management, device management, information maintenance, process control, communications and miscellaneous calls. Operating Systems are a colossal program consisiting of very intrinsic pieces all coming together to form what we now know today as Linux Kernel(2.6.30+) or Unix. System calls are simply a small building block, but nevertheless an essential piece, to the tower that is our Operating System.&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
Salus, Peter H. A Quarter Century of Unix, Publisher: Addison-Wesly Professional, June 10, 1994.&lt;br /&gt;
&lt;br /&gt;
Unix Programming Manual, http://cm.bell-labs.com/cm/cs/who/dmr/1stEdman.html, November 3, 1971.&lt;br /&gt;
&lt;br /&gt;
BSD System Calls Manual. http://www.unix.com/man-page/FreeBSD/2/,  The Unix and Linux Forums.&lt;br /&gt;
&lt;br /&gt;
Linux Programmer&#039;s Manual, Linux man-pages project.&lt;br /&gt;
http://www.kernel.org/doc/man-pages/&lt;br /&gt;
&lt;br /&gt;
Mendonça Rato, Luís Miguel,professor,university of evora.  http://www.di.uevora.pt/~lmr/syscalls.html&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_1_2010_Question_2&amp;diff=4262</id>
		<title>COMP 3000 Essay 1 2010 Question 2</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_1_2010_Question_2&amp;diff=4262"/>
		<updated>2010-10-15T00:16:37Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: /* File Management Calls */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Question=&lt;br /&gt;
How do the available system calls in modern versions of the Linux Kernel (2.6.30+) compare with the system calls available in the earliest versions of UNIX? How has the system call interface been expanded, and why? Focus on major changes or extensions in functionality.&lt;br /&gt;
&lt;br /&gt;
=Answer=&lt;br /&gt;
&lt;br /&gt;
A system call is a mean by which programs in the user space can access kernel services. Systems calls vary from operating system to operating system, although the underlying concepts tends to be the same. In general, a process is not supposed to be able to access the kernel directly. It can&#039;t access kernel memory and it can&#039;t call kernel functions. When the CPU prevents a process from accessing the kernel, this prevention is commonly known as, the protected mode. On the other hand, system calls are an exception to this rule. For example, older x86 processors used an interrupt mechanism to go from user-space to kernel-space, but newer processor (PentiumII+) provided instructions that optimize this transition using sysenter and sysexit instructions (Hayward, Mike. Intel P6 vs P7 system call performance. [http://lkml.org/lkml/2002/12/9/13], December 9, 2002).  All system calls are small programs built using the C programming language.&lt;br /&gt;
&lt;br /&gt;
The Unix and Linux systems calls are roughly grouped into 6 major categories: file management, device management, information maintenance, process control, communications and miscellaneous calls. The miscellaneous calls are all the ones that don’t really fit in the other categories, like system calls dealing with errors. Today, the Unix and Linux operating system contains hundreds of system calls but in general, they all came from the 35 system calls that came with one of the original UNIX OS in the early 70s. In the next paragraphs, we’re going to describe the various system calls in each of the categories mentioned above, their evolution through history (major changes in functionality) and a comparison with the earliest versions of UNIX.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== File Management Calls==&lt;br /&gt;
&lt;br /&gt;
The system calls in this group deal with every type of operation that is required to run a file system in the operating system. Create file, delete file, opening a file and closing a file are just a few examples of them and most of them hardly changed throughout the years. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;chmod&#039;&#039;, &#039;&#039;chown&#039;&#039; and &#039;&#039;chdir&#039;&#039; have been available since the first original UNIX (1971) and they are still used in today’s Linux kernels. The &#039;&#039;chmod&#039;&#039; and &#039;&#039;chown&#039;&#039; calls allows the users to change the file attributes and implements security to the file system. The system call &#039;&#039;chdir&#039;&#039; allows the process to change the current working directory. In the 4th distribution of UNIX from Berkeley (4BSD), new system calls were added to give more control of the file system to the applications. The call &#039;&#039;chroot&#039;&#039;  allows the process to change the current root directory with one specified in a path argument. &#039;&#039;fchmod&#039;&#039; and &#039;&#039;fchdir&#039;&#039; are the same as &#039;&#039;chmod&#039;&#039; and &#039;&#039;chdir&#039;&#039; except they takes file descriptors as arguments. As of Linux kernel 2.1.81, the &#039;&#039;chown&#039;&#039; system call now follows symbolic links and therefore, they introduced a new system call, &#039;&#039;lchown&#039;&#039;, that does not follow symbolic links.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another four of the original UNIX system calls are &#039;&#039;open&#039;&#039;, &#039;&#039;creat&#039;&#039;, &#039;&#039;mkdir&#039;&#039; and &#039;&#039;close&#039;&#039;. The &#039;&#039;open&#039;&#039; and &#039;&#039;creat&#039;&#039; calls allows processes to open and possibly create a file or device. Arguments flags are used to set from access modes, like O_RDONLY(read-only), to status flags, like O_APPEND(append mode). The only modifications made to the system calls were the addition of status flags where some of them are linux-specific. The &#039;&#039;close&#039;&#039; call allows processes to close a file descriptor preventing it to be reused. No changes were made to it. &#039;&#039;mkdir&#039;&#039; allows the creation of a file directory. In the earliest version of Unix, to delete a directory, users needed to make a series of &#039;&#039;link&#039;&#039; and &#039;&#039;unlink&#039;&#039; system calls. With Unix 4.2BSD, &#039;&#039;rmdir&#039;&#039; was added and helped solve the problem. The &#039;&#039;rename&#039;&#039; call was also added in 4.2BSD allowing processes to change the name or the location of a file. As file system became more complex, these new system calls helped the users gain better control over them.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is also system calls used to find, access and modify files. They are ’‘read’’, ‘‘write’’, ‘‘seek’’ and ‘‘stat’’. These were also part of the first UNIX built. The ‘‘read’’ and ‘‘write’’ system calls allows to read and write from a file (assigned to a file descriptor). The only change was in the Unix System V release 4(SVR4) where a &#039;&#039;write&#039;&#039; call could be interrupted at anytime. The ‘‘seek’’ system calls is used to go to a specified position in a file. This calls used a 16 bit address offset. But this was replaced very quickly for ‘‘lseek’’ as early as SVR4. It allows the call to use 32 bit address offsets. It is still used in modern Linux and Unix systems. As of now, developers are trying to implement ‘‘lseek64’’, a system call that will use 64 bit addresses. The ‘‘stat’’ system calls allows processes to get the status of a file. With SVR4, 2 other version of that system call were created: ‘‘fstat’’ and ‘‘lstat’’. They both do the same thing except ‘‘lstat’’ give the status of symbolic links and ‘‘fstat’’ give the status of a file specified by a file descriptor. Different operating systems will output different values to represent the state of a file. Since kernel 2.5.48, the stat returned a nanoseconds field in the file’s timestamp. With the release of 4.4BSD, two new system calls called ‘‘statvfs’’ and ‘‘fstatvfs’’ were introduced to provide information about a mounted file system. They both do the same thing except fstatvfs takes file descriptors as an argument. These calls are only used in an UNIX environment. In Linux, it has ‘‘statfs’’ and ‘‘fstatfs’’ to support that same call.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last two original UNIX system calls in this category that are still used today are &#039;&#039;link&#039;&#039; and &#039;&#039;unlink&#039;&#039;. &#039;&#039;link&#039;&#039; creates a hard link to an existing file and &#039;&#039;unlink&#039;&#039; deletes a file link’s name and possibly the file it refers to. If the name refers to a symbolic link, only the link is removed. No major changes were done to the &#039;&#039;unlink&#039;&#039; system calls but new system calls were create from &#039;&#039;link&#039;&#039;. The &#039;&#039;symlink&#039;&#039; system call was added in 4.2BSD to allow the creation of symbolic links in the file system. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the Linux 2.6.16 build, multiple system calls were created so that the calls could deal with relative pathnames as arguments. They can easily be spotted as the system call names all finish with &#039;at&#039;. Here is a sample list of the created system calls: &#039;&#039;openat&#039;&#039;, &#039;&#039;mkdirat&#039;&#039;, &#039;&#039;fchmodat&#039;&#039;, &#039;&#039;fchownat&#039;&#039;, &#039;&#039;fstatat&#039;&#039;, &#039;&#039;linkat&#039;&#039;, &#039;&#039;unlinkat&#039;&#039;, &#039;&#039;renameat&#039;&#039; and &#039;&#039;fchmodat&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Device Management Calls==&lt;br /&gt;
&lt;br /&gt;
The device management system calls are linked to hardware and they are mainly used to requests for devices, release devices, to logically attach a device or to detach it, get and modified device attributes and read and write to them. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two of the most important system calls for the UNIX and Linux operating system is ‘‘mount’’ and ‘‘umount’’. These were among the few system calls available in the first version of UNIX in 1971. The two calls allowed the operating system to load file systems on storage devices. A few changes were done to the mount system calls. Most of these changes were the creation of new mount flags to enhance performance. For example, since Linux 2.5.19, the MS_DIRSYNC flag permits the directory changes on a file system synchronous. Another Linux improvement was to provide per-process mount namespaces. This was added on the 2.4.19 kernel. If a process was created using clone() with the CLONE_NEWNS flag, the process will have a new namespace initialized to be a copy of the namespace of the process that was cloned. The ‘‘umount’’ system call unmounted the file system from the storage device. The only noteworthy change to ‘‘umount’’ was the creation of ‘‘umount2’’ in Linux 2.1.116. It is the same as ‘‘umount’’ except it allows different flags to control the operation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The ‘‘open’’, ‘‘read’’ and ‘‘write’’ calls can also be used to access devices. As discussed in the previous section, arguments flags are used to better control the device. You would use them as if the devices were files using the appropriate flags.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With the SVR4 came the system call ‘‘mmap’’. This system call is used to map or unmap files or devices into memory. Once a device is mapped, the system call returns a pointer to the mapped area allowing processes to access that device. This system call is still used in a Unix environment but since Linux 2.4, Linux replaced it by the mmap2 system call. It is basically the same as mmap except for a final argument specifying the offset into a file in 4096-byte units. This enables the mapping of large files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In version 7 of Unix, ‘‘ioctl’’ system call is used for device-specific operations that can’t be done using the standard system calls. This helps to deal with a multitude of devices. Each device drivers would provide a set of ioctl request code to allow various operations on their device. Each various request code are hardware dependent so there is no standard available for this system call.&lt;br /&gt;
&lt;br /&gt;
== Information Maintenance Calls==&lt;br /&gt;
Information maintenance calls are system calls that return the computers personal information back to the user or change it completely. These type of calls can be split up into three groups get/set time or date, get/set system data and get/set process, file, or device attributes. To fully understand the difference between Linux and UNIX in regrades to system calls, one must explore the three sub-types of information maintenance calls and see how they have changed over time.&lt;br /&gt;
&lt;br /&gt;
The first sub type is Get/set of time and/or date. In Linux, this can be done by a few different system calls, there are: &#039;gettimeofday&#039; to get the time, &#039;settimeofday&#039; to set it, &#039;time&#039; returns the time in seconds and a few other ones like &#039;ftime&#039;.In the earliest versions UNIX the used the system call was &#039;stime&#039;, which was used to  interact with time and dates. &#039;stime&#039; could return the time and date and sets the system’s idea of the time and date by altering the seconds. &#039;stime&#039; is still being used by Linux because it is successful, unlike &#039;settimeofday&#039;, which was created to change timezones (tz_dsttime) as well as the time but each occurrence of this field call in the kernel source (apart from declaration) is a bug thus failing. &lt;br /&gt;
&lt;br /&gt;
The second sub type is get/set system data. UNIX does this using the following commands: &#039;open&#039;, &#039;read&#039;, &#039;close&#039;, and &#039;write&#039;. &#039;open&#039; opens a file so the file can be written to or read from. &#039;read&#039; retrieves data from the file, and &#039;write&#039; modifies data in the file. &#039;close&#039; is used to indicate that the file is no longer in use. Linux uses the same set of commands for the same purposes.&lt;br /&gt;
&lt;br /&gt;
The third sub type is get/set process, file, or device attributes, in UNIX there are several system calls for processing file and device attributes, some of these examples are common to both UNIX and Linux: &#039;stat&#039; gets file status, &#039;fork&#039; spawns a new process and &#039;stty&#039; sets the mode of typewriter. In Linux there are a lot more system calls regarding the third sub type and here are a few of them: &#039;capget&#039; gets the capabilities of the process, &#039;capset&#039; sets the capabilities process, &#039;getppid&#039; gets process identification (and more), &#039;capget&#039; and &#039;capset&#039; interact with the raw kernel interface for getting and setting thread capabilities. These two system calls are specific to Linux and as such the use of these functions (in particular the format of the cap_user_*_t types) are updated as the kernel is updated. The &#039;getppid&#039; returns the process ID of the calling process and never has any errors.&lt;br /&gt;
&lt;br /&gt;
== Process Control Calls==&lt;br /&gt;
&lt;br /&gt;
== Communications Calls==&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous System Calls ==&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
Salus, Peter H. A Quarter Century of Unix, Publisher: Addison-Wesly Professional, June 10, 1994.&lt;br /&gt;
&lt;br /&gt;
Unix Programming Manual, http://cm.bell-labs.com/cm/cs/who/dmr/1stEdman.html, November 3, 1971.&lt;br /&gt;
&lt;br /&gt;
BSD System Calls Manual. http://www.unix.com/man-page/FreeBSD/2/,  The Unix and Linux Forums.&lt;br /&gt;
&lt;br /&gt;
Linux Programmer&#039;s Manual, Linux man-pages project.&lt;br /&gt;
http://www.kernel.org/doc/man-pages/&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_1_2010_Question_2&amp;diff=4259</id>
		<title>COMP 3000 Essay 1 2010 Question 2</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_1_2010_Question_2&amp;diff=4259"/>
		<updated>2010-10-15T00:15:54Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: /* Device Management Calls */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Question=&lt;br /&gt;
How do the available system calls in modern versions of the Linux Kernel (2.6.30+) compare with the system calls available in the earliest versions of UNIX? How has the system call interface been expanded, and why? Focus on major changes or extensions in functionality.&lt;br /&gt;
&lt;br /&gt;
=Answer=&lt;br /&gt;
&lt;br /&gt;
A system call is a mean by which programs in the user space can access kernel services. Systems calls vary from operating system to operating system, although the underlying concepts tends to be the same. In general, a process is not supposed to be able to access the kernel directly. It can&#039;t access kernel memory and it can&#039;t call kernel functions. When the CPU prevents a process from accessing the kernel, this prevention is commonly known as, the protected mode. On the other hand, system calls are an exception to this rule. For example, older x86 processors used an interrupt mechanism to go from user-space to kernel-space, but newer processor (PentiumII+) provided instructions that optimize this transition using sysenter and sysexit instructions (Hayward, Mike. Intel P6 vs P7 system call performance. [http://lkml.org/lkml/2002/12/9/13], December 9, 2002).  All system calls are small programs built using the C programming language.&lt;br /&gt;
&lt;br /&gt;
The Unix and Linux systems calls are roughly grouped into 6 major categories: file management, device management, information maintenance, process control, communications and miscellaneous calls. The miscellaneous calls are all the ones that don’t really fit in the other categories, like system calls dealing with errors. Today, the Unix and Linux operating system contains hundreds of system calls but in general, they all came from the 35 system calls that came with one of the original UNIX OS in the early 70s. In the next paragraphs, we’re going to describe the various system calls in each of the categories mentioned above, their evolution through history (major changes in functionality) and a comparison with the earliest versions of UNIX.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== File Management Calls==&lt;br /&gt;
&lt;br /&gt;
The system calls in this group deal with every type of operation that is required to run a file system in the operating system. Create file, delete file, opening a file and closing a file are just a few examples of them and most of them hardly changed throughout the years. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;chmod&#039;&#039;, &#039;&#039;chown&#039;&#039; and &#039;&#039;chdir&#039;&#039; have been available since the first original UNIX (1971) and they are still used in today’s Linux kernels. The &#039;&#039;chmod&#039;&#039; and &#039;&#039;chown&#039;&#039; calls allows the users to change the file attributes and implements security to the file system. The system call &#039;&#039;chdir&#039;&#039; allows the process to change the current working directory. In the 4th distribution of UNIX from Berkeley (4BSD), new system calls were added to give more control of the file system to the applications. The call &#039;&#039;chroot&#039;&#039;  allows the process to change the current root directory with one specified in a path argument. &#039;&#039;fchmod&#039;&#039; and &#039;&#039;fchdir&#039;&#039; are the same as &#039;&#039;chmod&#039;&#039; and &#039;&#039;chdir&#039;&#039; except they takes file descriptors as arguments. As of Linux kernel 2.1.81, the &#039;&#039;chown&#039;&#039; system call now follows symbolic links and therefore, they introduced a new system call, &#039;&#039;lchown&#039;&#039;, that does not follow symbolic links.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another four of the original UNIX system calls are &#039;&#039;open&#039;&#039;, &#039;&#039;creat&#039;&#039;, &#039;&#039;mkdir&#039;&#039; and &#039;&#039;close&#039;&#039;. The &#039;&#039;open&#039;&#039; and &#039;&#039;creat&#039;&#039; calls allows processes to open and possibly create a file or device. Arguments flags are used to set from access modes, like O_RDONLY(read-only), to status flags, like O_APPEND(append mode). The only modifications made to the system calls were the addition of status flags where some of them are linux-specific. The &#039;&#039;close&#039;&#039; call allows processes to close a file descriptor preventing it to be reused. No changes were made to it. &#039;&#039;mkdir&#039;&#039; allows the creation of a file directory. In the earliest version of Unix, to delete a directory, users needed to make a series of &#039;&#039;link&#039;&#039; and &#039;&#039;unlink&#039;&#039; system calls. With Unix 4.2BSD, &#039;&#039;rmdir&#039;&#039; was added and helped solve the problem. The &#039;&#039;rename&#039;&#039; call was also added in 4.2BSD allowing processes to change the name or the location of a file. As file system became more complex, these new system calls helped the users gain better control over them.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is also system calls used to find, access and modify files. They are ’‘read’’, ‘‘write’’, ‘‘seek’’ and ‘‘stat’’. These were also part of the first UNIX built. The ‘‘read’’ and ‘‘write’’ system calls allows to read and write from a file (assigned to a file descriptor). The only change was in the System V release 4(SVR4) where a &#039;&#039;write&#039;&#039; call could be interrupted at anytime. The ‘‘seek’’ system calls is used to go to a specified position in a file. This calls used a 16 bit address offset. But this was replaced very quickly for ‘‘lseek’’ as early as SVR4. It allows the call to use 32 bit address offsets. It is still used in modern Linux and Unix systems. As of now, developers are trying to implement ‘‘lseek64’’, a system call that will use 64 bit addresses. The ‘‘stat’’ system calls allows processes to get the status of a file. With SVR4, 2 other version of that system call were created: ‘‘fstat’’ and ‘‘lstat’’. They both do the same thing except ‘‘lstat’’ give the status of symbolic links and ‘‘fstat’’ give the status of a file specified by a file descriptor. Different operating systems will output different values to represent the state of a file. Since kernel 2.5.48, the stat returned a nanoseconds field in the file’s timestamp. With the release of 4.4BSD, two new system calls called ‘‘statvfs’’ and ‘‘fstatvfs’’ were introduced to provide information about a mounted file system. They both do the same thing except fstatvfs takes file descriptors as an argument. These calls are only used in an UNIX environment. In Linux, it has ‘‘statfs’’ and ‘‘fstatfs’’ to support that same call.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last two original UNIX system calls in this category that are still used today are &#039;&#039;link&#039;&#039; and &#039;&#039;unlink&#039;&#039;. &#039;&#039;link&#039;&#039; creates a hard link to an existing file and &#039;&#039;unlink&#039;&#039; deletes a file link’s name and possibly the file it refers to. If the name refers to a symbolic link, only the link is removed. No major changes were done to the &#039;&#039;unlink&#039;&#039; system calls but new system calls were create from &#039;&#039;link&#039;&#039;. The &#039;&#039;symlink&#039;&#039; system call was added in 4.2BSD to allow the creation of symbolic links in the file system. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the Linux 2.6.16 build, multiple system calls were created so that the calls could deal with relative pathnames as arguments. They can easily be spotted as the system call names all finish with &#039;at&#039;. Here is a sample list of the created system calls: &#039;&#039;openat&#039;&#039;, &#039;&#039;mkdirat&#039;&#039;, &#039;&#039;fchmodat&#039;&#039;, &#039;&#039;fchownat&#039;&#039;, &#039;&#039;fstatat&#039;&#039;, &#039;&#039;linkat&#039;&#039;, &#039;&#039;unlinkat&#039;&#039;, &#039;&#039;renameat&#039;&#039; and &#039;&#039;fchmodat&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Device Management Calls==&lt;br /&gt;
&lt;br /&gt;
The device management system calls are linked to hardware and they are mainly used to requests for devices, release devices, to logically attach a device or to detach it, get and modified device attributes and read and write to them. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two of the most important system calls for the UNIX and Linux operating system is ‘‘mount’’ and ‘‘umount’’. These were among the few system calls available in the first version of UNIX in 1971. The two calls allowed the operating system to load file systems on storage devices. A few changes were done to the mount system calls. Most of these changes were the creation of new mount flags to enhance performance. For example, since Linux 2.5.19, the MS_DIRSYNC flag permits the directory changes on a file system synchronous. Another Linux improvement was to provide per-process mount namespaces. This was added on the 2.4.19 kernel. If a process was created using clone() with the CLONE_NEWNS flag, the process will have a new namespace initialized to be a copy of the namespace of the process that was cloned. The ‘‘umount’’ system call unmounted the file system from the storage device. The only noteworthy change to ‘‘umount’’ was the creation of ‘‘umount2’’ in Linux 2.1.116. It is the same as ‘‘umount’’ except it allows different flags to control the operation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The ‘‘open’’, ‘‘read’’ and ‘‘write’’ calls can also be used to access devices. As discussed in the previous section, arguments flags are used to better control the device. You would use them as if the devices were files using the appropriate flags.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With the SVR4 came the system call ‘‘mmap’’. This system call is used to map or unmap files or devices into memory. Once a device is mapped, the system call returns a pointer to the mapped area allowing processes to access that device. This system call is still used in a Unix environment but since Linux 2.4, Linux replaced it by the mmap2 system call. It is basically the same as mmap except for a final argument specifying the offset into a file in 4096-byte units. This enables the mapping of large files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In version 7 of Unix, ‘‘ioctl’’ system call is used for device-specific operations that can’t be done using the standard system calls. This helps to deal with a multitude of devices. Each device drivers would provide a set of ioctl request code to allow various operations on their device. Each various request code are hardware dependent so there is no standard available for this system call.&lt;br /&gt;
&lt;br /&gt;
== Information Maintenance Calls==&lt;br /&gt;
Information maintenance calls are system calls that return the computers personal information back to the user or change it completely. These type of calls can be split up into three groups get/set time or date, get/set system data and get/set process, file, or device attributes. To fully understand the difference between Linux and UNIX in regrades to system calls, one must explore the three sub-types of information maintenance calls and see how they have changed over time.&lt;br /&gt;
&lt;br /&gt;
The first sub type is Get/set of time and/or date. In Linux, this can be done by a few different system calls, there are: &#039;gettimeofday&#039; to get the time, &#039;settimeofday&#039; to set it, &#039;time&#039; returns the time in seconds and a few other ones like &#039;ftime&#039;.In the earliest versions UNIX the used the system call was &#039;stime&#039;, which was used to  interact with time and dates. &#039;stime&#039; could return the time and date and sets the system’s idea of the time and date by altering the seconds. &#039;stime&#039; is still being used by Linux because it is successful, unlike &#039;settimeofday&#039;, which was created to change timezones (tz_dsttime) as well as the time but each occurrence of this field call in the kernel source (apart from declaration) is a bug thus failing. &lt;br /&gt;
&lt;br /&gt;
The second sub type is get/set system data. UNIX does this using the following commands: &#039;open&#039;, &#039;read&#039;, &#039;close&#039;, and &#039;write&#039;. &#039;open&#039; opens a file so the file can be written to or read from. &#039;read&#039; retrieves data from the file, and &#039;write&#039; modifies data in the file. &#039;close&#039; is used to indicate that the file is no longer in use. Linux uses the same set of commands for the same purposes.&lt;br /&gt;
&lt;br /&gt;
The third sub type is get/set process, file, or device attributes, in UNIX there are several system calls for processing file and device attributes, some of these examples are common to both UNIX and Linux: &#039;stat&#039; gets file status, &#039;fork&#039; spawns a new process and &#039;stty&#039; sets the mode of typewriter. In Linux there are a lot more system calls regarding the third sub type and here are a few of them: &#039;capget&#039; gets the capabilities of the process, &#039;capset&#039; sets the capabilities process, &#039;getppid&#039; gets process identification (and more), &#039;capget&#039; and &#039;capset&#039; interact with the raw kernel interface for getting and setting thread capabilities. These two system calls are specific to Linux and as such the use of these functions (in particular the format of the cap_user_*_t types) are updated as the kernel is updated. The &#039;getppid&#039; returns the process ID of the calling process and never has any errors.&lt;br /&gt;
&lt;br /&gt;
== Process Control Calls==&lt;br /&gt;
&lt;br /&gt;
== Communications Calls==&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous System Calls ==&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
Salus, Peter H. A Quarter Century of Unix, Publisher: Addison-Wesly Professional, June 10, 1994.&lt;br /&gt;
&lt;br /&gt;
Unix Programming Manual, http://cm.bell-labs.com/cm/cs/who/dmr/1stEdman.html, November 3, 1971.&lt;br /&gt;
&lt;br /&gt;
BSD System Calls Manual. http://www.unix.com/man-page/FreeBSD/2/,  The Unix and Linux Forums.&lt;br /&gt;
&lt;br /&gt;
Linux Programmer&#039;s Manual, Linux man-pages project.&lt;br /&gt;
http://www.kernel.org/doc/man-pages/&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_1_2010_Question_2&amp;diff=4251</id>
		<title>COMP 3000 Essay 1 2010 Question 2</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_1_2010_Question_2&amp;diff=4251"/>
		<updated>2010-10-15T00:12:27Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: /* File Management Calls */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Question=&lt;br /&gt;
How do the available system calls in modern versions of the Linux Kernel (2.6.30+) compare with the system calls available in the earliest versions of UNIX? How has the system call interface been expanded, and why? Focus on major changes or extensions in functionality.&lt;br /&gt;
&lt;br /&gt;
=Answer=&lt;br /&gt;
&lt;br /&gt;
A system call is a mean by which programs in the user space can access kernel services. Systems calls vary from operating system to operating system, although the underlying concepts tends to be the same. In general, a process is not supposed to be able to access the kernel directly. It can&#039;t access kernel memory and it can&#039;t call kernel functions. When the CPU prevents a process from accessing the kernel, this prevention is commonly known as, the protected mode. On the other hand, system calls are an exception to this rule. For example, older x86 processors used an interrupt mechanism to go from user-space to kernel-space, but newer processor (PentiumII+) provided instructions that optimize this transition using sysenter and sysexit instructions (Hayward, Mike. Intel P6 vs P7 system call performance. [http://lkml.org/lkml/2002/12/9/13], December 9, 2002).  All system calls are small programs built using the C programming language.&lt;br /&gt;
&lt;br /&gt;
The Unix and Linux systems calls are roughly grouped into 6 major categories: file management, device management, information maintenance, process control, communications and miscellaneous calls. The miscellaneous calls are all the ones that don’t really fit in the other categories, like system calls dealing with errors. Today, the Unix and Linux operating system contains hundreds of system calls but in general, they all came from the 35 system calls that came with one of the original UNIX OS in the early 70s. In the next paragraphs, we’re going to describe the various system calls in each of the categories mentioned above, their evolution through history (major changes in functionality) and a comparison with the earliest versions of UNIX.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== File Management Calls==&lt;br /&gt;
&lt;br /&gt;
The system calls in this group deal with every type of operation that is required to run a file system in the operating system. Create file, delete file, opening a file and closing a file are just a few examples of them and most of them hardly changed throughout the years. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;chmod&#039;&#039;, &#039;&#039;chown&#039;&#039; and &#039;&#039;chdir&#039;&#039; have been available since the first original UNIX (1971) and they are still used in today’s Linux kernels. The &#039;&#039;chmod&#039;&#039; and &#039;&#039;chown&#039;&#039; calls allows the users to change the file attributes and implements security to the file system. The system call &#039;&#039;chdir&#039;&#039; allows the process to change the current working directory. In the 4th distribution of UNIX from Berkeley (4BSD), new system calls were added to give more control of the file system to the applications. The call &#039;&#039;chroot&#039;&#039;  allows the process to change the current root directory with one specified in a path argument. &#039;&#039;fchmod&#039;&#039; and &#039;&#039;fchdir&#039;&#039; are the same as &#039;&#039;chmod&#039;&#039; and &#039;&#039;chdir&#039;&#039; except they takes file descriptors as arguments. As of Linux kernel 2.1.81, the &#039;&#039;chown&#039;&#039; system call now follows symbolic links and therefore, they introduced a new system call, &#039;&#039;lchown&#039;&#039;, that does not follow symbolic links.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another four of the original UNIX system calls are &#039;&#039;open&#039;&#039;, &#039;&#039;creat&#039;&#039;, &#039;&#039;mkdir&#039;&#039; and &#039;&#039;close&#039;&#039;. The &#039;&#039;open&#039;&#039; and &#039;&#039;creat&#039;&#039; calls allows processes to open and possibly create a file or device. Arguments flags are used to set from access modes, like O_RDONLY(read-only), to status flags, like O_APPEND(append mode). The only modifications made to the system calls were the addition of status flags where some of them are linux-specific. The &#039;&#039;close&#039;&#039; call allows processes to close a file descriptor preventing it to be reused. No changes were made to it. &#039;&#039;mkdir&#039;&#039; allows the creation of a file directory. In the earliest version of Unix, to delete a directory, users needed to make a series of &#039;&#039;link&#039;&#039; and &#039;&#039;unlink&#039;&#039; system calls. With Unix 4.2BSD, &#039;&#039;rmdir&#039;&#039; was added and helped solve the problem. The &#039;&#039;rename&#039;&#039; call was also added in 4.2BSD allowing processes to change the name or the location of a file. As file system became more complex, these new system calls helped the users gain better control over them.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is also system calls used to find, access and modify files. They are ’‘read’’, ‘‘write’’, ‘‘seek’’ and ‘‘stat’’. These were also part of the first UNIX built. The ‘‘read’’ and ‘‘write’’ system calls allows to read and write from a file (assigned to a file descriptor). The only change was in the System V release 4(SVR4) where a &#039;&#039;write&#039;&#039; call could be interrupted at anytime. The ‘‘seek’’ system calls is used to go to a specified position in a file. This calls used a 16 bit address offset. But this was replaced very quickly for ‘‘lseek’’ as early as SVR4. It allows the call to use 32 bit address offsets. It is still used in modern Linux and Unix systems. As of now, developers are trying to implement ‘‘lseek64’’, a system call that will use 64 bit addresses. The ‘‘stat’’ system calls allows processes to get the status of a file. With SVR4, 2 other version of that system call were created: ‘‘fstat’’ and ‘‘lstat’’. They both do the same thing except ‘‘lstat’’ give the status of symbolic links and ‘‘fstat’’ give the status of a file specified by a file descriptor. Different operating systems will output different values to represent the state of a file. Since kernel 2.5.48, the stat returned a nanoseconds field in the file’s timestamp. With the release of 4.4BSD, two new system calls called ‘‘statvfs’’ and ‘‘fstatvfs’’ were introduced to provide information about a mounted file system. They both do the same thing except fstatvfs takes file descriptors as an argument. These calls are only used in an UNIX environment. In Linux, it has ‘‘statfs’’ and ‘‘fstatfs’’ to support that same call.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last two original UNIX system calls in this category that are still used today are &#039;&#039;link&#039;&#039; and &#039;&#039;unlink&#039;&#039;. &#039;&#039;link&#039;&#039; creates a hard link to an existing file and &#039;&#039;unlink&#039;&#039; deletes a file link’s name and possibly the file it refers to. If the name refers to a symbolic link, only the link is removed. No major changes were done to the &#039;&#039;unlink&#039;&#039; system calls but new system calls were create from &#039;&#039;link&#039;&#039;. The &#039;&#039;symlink&#039;&#039; system call was added in 4.2BSD to allow the creation of symbolic links in the file system. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the Linux 2.6.16 build, multiple system calls were created so that the calls could deal with relative pathnames as arguments. They can easily be spotted as the system call names all finish with &#039;at&#039;. Here is a sample list of the created system calls: &#039;&#039;openat&#039;&#039;, &#039;&#039;mkdirat&#039;&#039;, &#039;&#039;fchmodat&#039;&#039;, &#039;&#039;fchownat&#039;&#039;, &#039;&#039;fstatat&#039;&#039;, &#039;&#039;linkat&#039;&#039;, &#039;&#039;unlinkat&#039;&#039;, &#039;&#039;renameat&#039;&#039; and &#039;&#039;fchmodat&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Device Management Calls==&lt;br /&gt;
&lt;br /&gt;
The device management system calls are linked to hardware and they are mainly used to requests for devices, release devices, to logically attach a device or to detach it, get and modified device attributes and read and write to them. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two of the most important system calls for the UNIX and Linux operating system is ‘‘mount’’ and ‘‘umount’’. These were among the few system calls available in UNIX in the 70s. The two calls allowed the operating system to load file systems on storage devices. A few changes were done to the mount system calls most of them were the creation of new mount flags to enhance performance. For example, since Linux 2.5.19, the MS_DIRSYNC flag permits the directory changes on a file system synchronous. Another Linux improvement was to provide per-process mount namespaces. This was added on the 2.4.19 kernel. If a process was created using clone() with the CLONE_NEWNS flag, the process will have a new namespace initialized to be a copy of the namespace of the process that was cloned. The ‘‘umount’’ system call unmounted the file system from the storage device. The only noteworthy change to ‘‘umount’’ was the creation of ‘‘umount2’’ in Linux 2.1.116. It is the same as ‘‘umount’’ except it allows different flags to control the operation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The ‘‘open’’, ‘‘read’’ and ‘‘write’’ calls can also be used to access devices. As discussed in the previous section, arguments flags are used to better control the device. You would use them as if the devices were files using the appropriate flags.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With the System V Unix revision 4(SVR4) came the system call ‘‘mmap’’. This system call is used to map or unmap files or devices into memory. Once a device is mapped, the system call returns a pointer to the mapped area allowing processes to access that device. This system call is still used in a Unix environment but since Linux 2.4, Linux replaced it by the mmap2 system call. It is basically the same as mmap except for a final argument specifying the offset into a file in 4096-byte units. This enables the mapping of large files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In version 7 of Unix, ‘‘ioctl’’ system call is used for device-specific operations that can’t be done using the standard system calls. This helps to deal with a multitude of devices. Each device drivers would provide a set of ioctl request code to allow various operations on their device. Each various request code are hardware dependent so there is no standard available for this system call.&lt;br /&gt;
&lt;br /&gt;
== Information Maintenance Calls==&lt;br /&gt;
Information maintenance calls are system calls that return the computers personal information back to the user or change it completely. These type of calls can be split up into three groups get/set time or date, get/set system data and get/set process, file, or device attributes. To fully understand the difference between Linux and UNIX in regrades to system calls, one must explore the three sub-types of information maintenance calls and see how they have changed over time.&lt;br /&gt;
&lt;br /&gt;
The first sub type is Get/set of time and/or date. In Linux, this can be done by a few different system calls, there are: &#039;gettimeofday&#039; to get the time, &#039;settimeofday&#039; to set it, &#039;time&#039; returns the time in seconds and a few other ones like &#039;ftime&#039;.In the earliest versions UNIX the used the system call was &#039;stime&#039;, which was used to  interact with time and dates. &#039;stime&#039; could return the time and date and sets the system’s idea of the time and date by altering the seconds. &#039;stime&#039; is still being used by Linux because it is successful, unlike &#039;settimeofday&#039;, which was created to change timezones (tz_dsttime) as well as the time but each occurrence of this field call in the kernel source (apart from declaration) is a bug thus failing. &lt;br /&gt;
&lt;br /&gt;
The second sub type is get/set system data. UNIX does this using the following commands: &#039;open&#039;, &#039;read&#039;, &#039;close&#039;, and &#039;write&#039;. &#039;open&#039; opens a file so the file can be written to or read from. &#039;read&#039; retrieves data from the file, and &#039;write&#039; modifies data in the file. &#039;close&#039; is used to indicate that the file is no longer in use. Linux uses the same set of commands for the same purposes.&lt;br /&gt;
&lt;br /&gt;
The third sub type is get/set process, file, or device attributes, in UNIX there are several system calls for processing file and device attributes, some of these examples are common to both UNIX and Linux: &#039;stat&#039; gets file status, &#039;fork&#039; spawns a new process and &#039;stty&#039; sets the mode of typewriter. In Linux there are a lot more system calls regarding the third sub type and here are a few of them: &#039;capget&#039; gets the capabilities of the process, &#039;capset&#039; sets the capabilities process, &#039;getppid&#039; gets process identification (and more), &#039;capget&#039; and &#039;capset&#039; interact with the raw kernel interface for getting and setting thread capabilities. These two system calls are specific to Linux and as such the use of these functions (in particular the format of the cap_user_*_t types) are updated as the kernel is updated. The &#039;getppid&#039; returns the process ID of the calling process and never has any errors.&lt;br /&gt;
&lt;br /&gt;
== Process Control Calls==&lt;br /&gt;
&lt;br /&gt;
== Communications Calls==&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous System Calls ==&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
Salus, Peter H. A Quarter Century of Unix, Publisher: Addison-Wesly Professional, June 10, 1994.&lt;br /&gt;
&lt;br /&gt;
Unix Programming Manual, http://cm.bell-labs.com/cm/cs/who/dmr/1stEdman.html, November 3, 1971.&lt;br /&gt;
&lt;br /&gt;
BSD System Calls Manual. http://www.unix.com/man-page/FreeBSD/2/,  The Unix and Linux Forums.&lt;br /&gt;
&lt;br /&gt;
Linux Programmer&#039;s Manual, Linux man-pages project.&lt;br /&gt;
http://www.kernel.org/doc/man-pages/&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_1_2010_Question_2&amp;diff=4210</id>
		<title>COMP 3000 Essay 1 2010 Question 2</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_1_2010_Question_2&amp;diff=4210"/>
		<updated>2010-10-14T23:55:26Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: /* File Management Calls */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Question=&lt;br /&gt;
How do the available system calls in modern versions of the Linux Kernel (2.6.30+) compare with the system calls available in the earliest versions of UNIX? How has the system call interface been expanded, and why? Focus on major changes or extensions in functionality.&lt;br /&gt;
&lt;br /&gt;
=Answer=&lt;br /&gt;
&lt;br /&gt;
A system call is a mean by which programs in the user space can access kernel services. Systems calls vary from operating system to operating system, although the underlying concepts tends to be the same. In general, a process is not supposed to be able to access the kernel directly. It can&#039;t access kernel memory and it can&#039;t call kernel functions. When the CPU prevents a process from accessing the kernel, this prevention is commonly known as, the protected mode. On the other hand, system calls are an exception to this rule. For example, older x86 processors used an interrupt mechanism to go from user-space to kernel-space, but newer processor (PentiumII+) provided instructions that optimize this transition using sysenter and sysexit instructions (Hayward, Mike. Intel P6 vs P7 system call performance. [http://lkml.org/lkml/2002/12/9/13], December 9, 2002).  All system calls are small programs built using the C programming language.&lt;br /&gt;
&lt;br /&gt;
The Unix and Linux systems calls are roughly grouped into 6 major categories: file management, device management, information maintenance, process control, communications and miscellaneous calls. The miscellaneous calls are all the ones that don’t really fit in the other categories, like system calls dealing with errors. Today, the Unix and Linux operating system contains hundreds of system calls but in general, they all came from the 35 system calls that came with one of the original UNIX OS in the early 70s. In the next paragraphs, we’re going to describe the various system calls in each of the categories mentioned above, their evolution through history (major changes in functionality) and a comparison with the earliest versions of UNIX.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== File Management Calls==&lt;br /&gt;
&lt;br /&gt;
The system calls in this group deal with every type of operation that is required to run a file system in the operating system. Create file, delete file, opening a file and closing a file are just a few examples of them and most of them hardly changed throughout the years. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;chmod&#039;&#039;, &#039;&#039;chown&#039;&#039; and &#039;&#039;chdir&#039;&#039; has been available since the first original UNIX (1971) and it is still used in today’s Linux kernels. The &#039;&#039;chmod&#039;&#039; and &#039;&#039;chown&#039;&#039; calls allows the users to change the file attributes and implements security to the file system. The system call &#039;&#039;chdir&#039;&#039; allows the process to change the current working directory. In the 4th distribution of UNIX from Berkeley (4BSD), new system calls were added to be able to give more control on the file system to the applications. The call &#039;&#039;chroot&#039;&#039;  allows the process to change the current root directory with one specified in a path argument. &#039;&#039;fchmod&#039;&#039; and &#039;&#039;fchdir&#039;&#039; are the same as &#039;&#039;chmod&#039;&#039; and &#039;&#039;chdir&#039;&#039; except it takes file descriptors as arguments. As of Linux kernel 2.1.81, the &#039;&#039;chown&#039;&#039; system call follows symbolic link and introduce a new system call, &#039;&#039;lchown&#039;&#039;, that does not follow symbolic links.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another four of the original UNIX system calls are &#039;&#039;open&#039;&#039;, &#039;&#039;creat&#039;&#039;, &#039;&#039;mkdir&#039;&#039; and &#039;&#039;close&#039;&#039;. The &#039;&#039;open&#039;&#039; and &#039;&#039;creat&#039;&#039; calls allows processes to open and possibly create a file or device. Arguments flags are used to set either access modes, like O_RDONLY(read-only), to status flags, like O_APPEND(append mode). The only modifications made to the system calls were the addition of status flags where some of them are only linux-specific. The &#039;&#039;close&#039;&#039; call allows processes to close a file descriptor preventing it to be reused. No changes were made to it. &#039;&#039;mkdir&#039;&#039; allows the creation of a file directory. At that point, to delete a directory, users would need to make a series of &#039;&#039;link&#039;&#039; and &#039;&#039;unlink&#039;&#039; system calls. With Unix 4.2BSD, &#039;&#039;rmdir&#039;&#039; and solved the problem. The &#039;&#039;rename&#039;&#039; call was also added in 4.2BSD allowing processes to change the name or the location of a file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is also system calls used to find, access and modify files. They are ’‘read’’, ‘‘write’’, ‘‘seek’’ and ‘‘stat’’. These were also part of the first UNIX built. The ‘‘read’’ and ‘‘write’’ system calls allows to read and write from a file (assigned to a file descriptor). The only change was in SVR4 where a write can be interrupted at anytime. The ‘‘seek’’ system calls is used to go to a specified position in a file. This calls used a 16 bit address. But this was replaced very quickly for ‘‘lseek’’ as early as SVR4. It allows the call to use 32 bit addresses. It is still used in modern Linux and Unix systems even if developers are trying to implement ‘‘lseek64’’, a system call that will use 64 bit addresses. The ‘‘stat’’ system calls allows processes to get the status of a file. With SVR4, 2 other version of that system call were created: ‘‘fstat’’ and ‘‘lstat’’. They both do the same thing except ‘‘lstat’’ give the status of symbolic links and ‘‘fstat’’ give the status of a file specified by a file descriptor. Different operating systems will output different values to represent the state of a file. Since kernel 2.5.48, the stat returned a nanoseconds field in the file’s timestamp. With the release of 4.4BSD, two new system calls called ‘‘statvfs’’ and ‘‘fstatvfs’’ were introduced to provide information about a mounted file system. They both do the same thing except fstatvfs takes file descriptors as an argument. These calls are only used in an UNIX environment. In Linux, it has ‘‘statfs’’ and ‘‘fstatfs’’ to support that same call.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last two original UNIX system calls in this category that are still used today are &#039;&#039;link&#039;&#039; and &#039;&#039;unlink&#039;&#039;. &#039;&#039;link&#039;&#039; creates a hard link to an existing file and &#039;&#039;unlink&#039;&#039; deletes a file link’s name and possibly the file it refers to. If the name refers to a symbolic link, only the link is removed. No major changes were done to the &#039;&#039;unlink&#039;&#039; system calls but new system calls were create from &#039;&#039;link&#039;&#039;. The &#039;&#039;symlink&#039;&#039; system call was added in 4.2BSD to allow the creation of symbolic links in the file system. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the Linux 2.6.16 build, multiple system calls were created so that the calls could deal with relative pathnames as arguments. They can easily be spotted as the system call names all finish with &#039;at&#039;. Here is a sample list of the created system calls: &#039;&#039;openat&#039;&#039;, &#039;&#039;mkdirat&#039;&#039;, &#039;&#039;fchmodat&#039;&#039;, &#039;&#039;fchownat&#039;&#039;, &#039;&#039;fstatat&#039;&#039;, &#039;&#039;linkat&#039;&#039;, &#039;&#039;unlinkat&#039;&#039;, &#039;&#039;renameat&#039;&#039; and &#039;&#039;fchmodat&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Device Management Calls==&lt;br /&gt;
&lt;br /&gt;
The device management system calls are linked to hardware and they are mainly used to requests for devices, release devices, to logically attach a device or to detach it, get and modified device attributes and read and write to them. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two of the most important system calls for the UNIX and Linux operating system is ‘‘mount’’ and ‘‘umount’’. These were among the few system calls available in UNIX in the 70s. The two calls allowed the operating system to load file systems on storage devices. A few changes were done to the mount system calls most of them were the creation of new mount flags to enhance performance. For example, since Linux 2.5.19, the MS_DIRSYNC flag permits the directory changes on a file system synchronous. Another Linux improvement was to provide per-process mount namespaces. This was added on the 2.4.19 kernel. If a process was created using clone() with the CLONE_NEWNS flag, the process will have a new namespace initialized to be a copy of the namespace of the process that was cloned. The ‘‘umount’’ system call unmounted the file system from the storage device. The only noteworthy change to ‘‘umount’’ was the creation of ‘‘umount2’’ in Linux 2.1.116. It is the same as ‘‘umount’’ except it allows different flags to control the operation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The ‘‘open’’, ‘‘read’’ and ‘‘write’’ calls can also be used to access devices. As discussed in the previous section, arguments flags are used to better control the device. You would use them as if the devices were files using the appropriate flags.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With the System V Unix revision 4(SVR4) came the system call ‘‘mmap’’. This system call is used to map or unmap files or devices into memory. Once a device is mapped, the system call returns a pointer to the mapped area allowing processes to access that device. This system call is still used in a Unix environment but since Linux 2.4, Linux replaced it by the mmap2 system call. It is basically the same as mmap except for a final argument specifying the offset into a file in 4096-byte units. This enables the mapping of large files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In version 7 of Unix, ‘‘ioctl’’ system call is used for device-specific operations that can’t be done using the standard system calls. This helps to deal with a multitude of devices. Each device drivers would provide a set of ioctl request code to allow various operations on their device. Each various request code are hardware dependent so there is no standard available for this system call.&lt;br /&gt;
&lt;br /&gt;
== Information Maintenance Calls==&lt;br /&gt;
Information maintenance calls are system calls that return the computers personal information back to the user or change it completely. These type of calls can be split up into three groups get/set time or date, get/set system data and get/set process, file, or device attributes. To fully understand the difference between Linux and UNIX in regrades to system calls, one must explore the three sub-types of information maintenance calls and see how they have changed over time.&lt;br /&gt;
&lt;br /&gt;
The first sub type is Get/set of time and/or date. In Linux, this can be done by a few different system calls, there are: &#039;gettimeofday&#039; to get the time, &#039;settimeofday&#039; to set it, &#039;time&#039; returns the time in seconds and a few other ones like &#039;ftime&#039;.In the earliest versions UNIX the used the system call was &#039;stime&#039;, which was used to  interact with time and dates. &#039;stime&#039; could return the time and date and sets the system’s idea of the time and date by altering the seconds. &#039;stime&#039; is still being used by Linux because it is successful, unlike &#039;settimeofday&#039;, which was created to change timezones (tz_dsttime) as well as the time but each occurrence of this field call in the kernel source (apart from declaration) is a bug thus failing. &lt;br /&gt;
&lt;br /&gt;
The second sub type is get/set system data. UNIX does this using the following commands: &#039;open&#039;, &#039;read&#039;, &#039;close&#039;, and &#039;write&#039;. &#039;open&#039; opens a file so the file can be written to or read from. &#039;read&#039; retrieves data from the file, and &#039;write&#039; modifies data in the file. &#039;close&#039; is used to indicate that the file is no longer in use. Linux uses the same set of commands for the same purposes.&lt;br /&gt;
&lt;br /&gt;
The third sub type is get/set process, file, or device attributes, in UNIX there are several system calls for processing file and device attributes, some of these examples are common to both UNIX and Linux: &#039;stat&#039; gets file status, &#039;fork&#039; spawns a new process and &#039;stty&#039; sets the mode of typewriter. In Linux there are a lot more system calls regarding the third sub type and here are a few of them: &#039;capget&#039; gets the capabilities of the process, &#039;capset&#039; sets the capabilities process, &#039;getppid&#039; gets process identification (and more), &#039;capget&#039; and &#039;capset&#039; interact with the raw kernel interface for getting and setting thread capabilities. These two system calls are specific to Linux and as such the use of these functions (in particular the format of the cap_user_*_t types) are updated as the kernel is updated. The &#039;getppid&#039; returns the process ID of the calling process and never has any errors.&lt;br /&gt;
&lt;br /&gt;
== Process Control Calls==&lt;br /&gt;
&lt;br /&gt;
== Communications Calls==&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous System Calls ==&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
Salus, Peter H. A Quarter Century of Unix, Publisher: Addison-Wesly Professional, June 10, 1994.&lt;br /&gt;
&lt;br /&gt;
Unix Programming Manual, http://cm.bell-labs.com/cm/cs/who/dmr/1stEdman.html, November 3, 1971.&lt;br /&gt;
&lt;br /&gt;
BSD System Calls Manual. http://www.unix.com/man-page/FreeBSD/2/,  The Unix and Linux Forums.&lt;br /&gt;
&lt;br /&gt;
Linux Programmer&#039;s Manual, Linux man-pages project.&lt;br /&gt;
http://www.kernel.org/doc/man-pages/&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=Talk:COMP_3000_Essay_1_2010_Question_2&amp;diff=4208</id>
		<title>Talk:COMP 3000 Essay 1 2010 Question 2</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=Talk:COMP_3000_Essay_1_2010_Question_2&amp;diff=4208"/>
		<updated>2010-10-14T23:54:13Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Not in this group and I&#039;m not completely sure if this is relevant but I found that UNIX used the POSIX standard while Linux used LSB which is based on the POSIX standard. &lt;br /&gt;
This article outlines some conflicts between them [https://www.opengroup.org/platform/single_unix_specification/uploads/40/13450/POSIX_and_Linux_Application_Compatibility_Final_-_v1.0.pdf]. I didn&#039;t find the actual comparisons very comprehensible but the ideas are there. --[[User:Slay|Slay]] 15:05, 7 October 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Uh, where did Figure 1 and much of the current text come from?  It looks like it was cut and pasted from random source.  Please don&#039;t plagarize!  --[[User:Soma|Anil]] (19:24, 8 October 2010 (UTC))&lt;br /&gt;
&lt;br /&gt;
Look into the reference article &amp;quot;Kernel command using Linux system calls&amp;quot;. Plagiarism is not my goal. I&#039;m using my own words to make a simple but complete description of a system call using the interrupt method. Check the references and If you think it is too close, please let me know. It is hard when an author makes such a good and clear description.--[[User:Sblais2|Sblais2]] 21:02, 8 October 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
I thought it would be nice to first describe what is a system calls and the two current methods of doing them. The first is the interrupt method. The second which is used in Linux 2.6.18+ is using the sysenter and sysexit instructions.--[[User:Sblais2|Sblais2]] 19:56, 8 October 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
You can&#039;t use that figure.  And you can&#039;t copy the text either, even if you change the words slightly.  But really, you&#039;re just wasting your time.  This question is not talking about how system calls are invoked; if you wanted to discuss this, you should be discussing system call invocation mechanisms on the PDP-11 and VAX systems!  Here I&#039;m interested in what are the calls, i.e., kernel functions that can be invoked by a regular program.--[[User:Soma|Anil]]&lt;br /&gt;
&lt;br /&gt;
This link provides about 40 UNIX system calls along with example on where they would be used from the looks of it: [http://www.di.uevora.pt/~lmr/syscalls.html]. --[[User:Apharan2|Apharan2]]&lt;br /&gt;
&lt;br /&gt;
Thank you for clarifying things. I will go that route. --[[User:Sblais2|Sblais2]] 13:08, 12 October 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
I don&#039;t see everyone contributing to this group. Please do let the others in your group know, divide your work into sections and discuss here. If you have questions - ask.--[[User:praman|Preeti]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This link shows all the system calls from Linux 2.6.33 [http://www.kernel.org/doc/man-pages/online/pages/man2/syscalls.2.html]&lt;br /&gt;
--[[User:Sblais2|Sblais2]] 23:36, 12 October 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
As no one in our group made suggestion on the format of our essay, I&#039;ve put one in place. In your research, each system calls should fit in one of the category. If someone picks one up. Please let me know ASAP. I will be working on that all day. Read the intro&#039;s last paragraph if your not sure what you should write on. My english writing skills are not perfect so if one of you guys see ways to improved the text, please do. --[[User:Sblais2|Sblais2]] 14:29, 13 October 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
Well I feel like I&#039;m the only one in that team but...Anyway I&#039;ve completed the first 2 sections. Please try working on the next 4.  If you want to modify something, please post a small gist of it in here so we can all validate. Thanks. --[[User:Sblais2|Sblais2]] 20:10, 13 October 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
I am wondering if we have actually split up the work accordingly i am going to a temped to answer Information Maintenance if anyone has dibs please let me know - Csulliva&lt;br /&gt;
I am finding this site that I find very helpfull to understand system called for linux an UNIX &lt;br /&gt;
http://ss64.com/bash/&lt;br /&gt;
-Csulliva&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;ll do process control calls. and help out on the last part that is not written up yet.I&#039;ll read the other parts as well just to get an understanding. [[User:Apharan2|Apharan2]]&lt;br /&gt;
&lt;br /&gt;
Csullliva, be careful not to confuse system calls and shell commands. Some of them have actually the same name, like &#039;&#039;mkdir&#039;&#039;. But shell commands is on the user-level. Some of them will actually do system calls to complete the operation.&lt;br /&gt;
It&#039;s good to finally hear from you guys.--[[User:Sblais2|Sblais2]] 01:39, 14 October 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
I&#039;ll work on the communication calls and the miscellaneous system calls. Not sure if you guys wanted to add more to this, but I can help out with writing a conclusion as well. I&#039;m somewhat good at writing, so if i see any little things that I could touch up on, i&#039;ll help out with that.-R.arteaga&lt;br /&gt;
&lt;br /&gt;
after my confusion with bash and system calls i had some trouble find a  system calls for linux that would effect time here a web site I found that helped me out with description regarding the calls http://www.digilife.be/quickreferences/QRC/LINUX%20System%20Call%20Quick%20Reference.pdf&lt;br /&gt;
hopefully i am on the write track now....some one stop me if i am not -Csulliva&lt;br /&gt;
&lt;br /&gt;
Looks ok to me Csulliva, might want to check the link I posted in this discussion. It shows all the system calls in the Linux kernel 2.6.30. Then even show history information in it. It is then easy to track early Unix implementation. R.arteaga -&amp;gt; That would be great. I started thinking about a conclusion but writing is not my forte (unless I am underestimating myself). --[[User:Sblais2|Sblais2]] 11:59, 14 October 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
Also not to forget to add your references. I added mine in the reference section. --[[User:Sblais2|Sblais2]] 19:02, 14 October 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
My writing skills have never been any good. I&#039;ve read through a whole bunch of the page and fixed a few typos here and there. I want to add to the &amp;quot;Information Maintenance Calls&amp;quot; section, but I can&#039;t promise that it will be any good. So feel free to help me out. -Dlangloi&lt;br /&gt;
&lt;br /&gt;
okay well i am currently working on the information maintenance calls part and i am a little stuck on the type system data so by all means help out.. that being said can anyone give me a hint on a system call that works with a system data in UNIX because i read the manual and i still drawing a blank, thanks-Csulliva&lt;br /&gt;
&lt;br /&gt;
Ya I have also had troubles trying to find system calls that affect system data. I have read through about half of that manuel in the references, but nothing seems to be related. Anyways, my eyes are starting to hurt. I will try again later and see if something turns up. -Dlangloi&lt;br /&gt;
I&#039;ve added to it but I have my doubts that it is correct. Please revise my work as it could be wrong. -Dlangloi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Just to make sure before I add stuff to the page: are the exec(),fork(), wait(), and exit() calls be considered part of process control calls ? [[User:Apharan2|Apharan2]]&lt;br /&gt;
&lt;br /&gt;
Apharan2=&amp;gt; yes they are considered part of process control as they deal directly with processes. Check this link out for more detail [http://www.softpanorama.org/Internals/unix_system_calls.shtml]. --[[User:Sblais2|Sblais2]] 23:54, 14 October 2010 (UTC)&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=Talk:COMP_3000_Essay_1_2010_Question_2&amp;diff=3964</id>
		<title>Talk:COMP 3000 Essay 1 2010 Question 2</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=Talk:COMP_3000_Essay_1_2010_Question_2&amp;diff=3964"/>
		<updated>2010-10-14T19:02:08Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Not in this group and I&#039;m not completely sure if this is relevant but I found that UNIX used the POSIX standard while Linux used LSB which is based on the POSIX standard. &lt;br /&gt;
This article outlines some conflicts between them [https://www.opengroup.org/platform/single_unix_specification/uploads/40/13450/POSIX_and_Linux_Application_Compatibility_Final_-_v1.0.pdf]. I didn&#039;t find the actual comparisons very comprehensible but the ideas are there. --[[User:Slay|Slay]] 15:05, 7 October 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Uh, where did Figure 1 and much of the current text come from?  It looks like it was cut and pasted from random source.  Please don&#039;t plagarize!  --[[User:Soma|Anil]] (19:24, 8 October 2010 (UTC))&lt;br /&gt;
&lt;br /&gt;
Look into the reference article &amp;quot;Kernel command using Linux system calls&amp;quot;. Plagiarism is not my goal. I&#039;m using my own words to make a simple but complete description of a system call using the interrupt method. Check the references and If you think it is too close, please let me know. It is hard when an author makes such a good and clear description.--[[User:Sblais2|Sblais2]] 21:02, 8 October 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
I thought it would be nice to first describe what is a system calls and the two current methods of doing them. The first is the interrupt method. The second which is used in Linux 2.6.18+ is using the sysenter and sysexit instructions.--[[User:Sblais2|Sblais2]] 19:56, 8 October 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
You can&#039;t use that figure.  And you can&#039;t copy the text either, even if you change the words slightly.  But really, you&#039;re just wasting your time.  This question is not talking about how system calls are invoked; if you wanted to discuss this, you should be discussing system call invocation mechanisms on the PDP-11 and VAX systems!  Here I&#039;m interested in what are the calls, i.e., kernel functions that can be invoked by a regular program.--[[User:Soma|Anil]]&lt;br /&gt;
&lt;br /&gt;
This link provides about 40 UNIX system calls along with example on where they would be used from the looks of it: [http://www.di.uevora.pt/~lmr/syscalls.html]. --[[User:Apharan2|Apharan2]]&lt;br /&gt;
&lt;br /&gt;
Thank you for clarifying things. I will go that route. --[[User:Sblais2|Sblais2]] 13:08, 12 October 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
I don&#039;t see everyone contributing to this group. Please do let the others in your group know, divide your work into sections and discuss here. If you have questions - ask.--[[User:praman|Preeti]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This link shows all the system calls from Linux 2.6.33 [http://www.kernel.org/doc/man-pages/online/pages/man2/syscalls.2.html]&lt;br /&gt;
--[[User:Sblais2|Sblais2]] 23:36, 12 October 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
As no one in our group made suggestion on the format of our essay, I&#039;ve put one in place. In your research, each system calls should fit in one of the category. If someone picks one up. Please let me know ASAP. I will be working on that all day. Read the intro&#039;s last paragraph if your not sure what you should write on. My english writing skills are not perfect so if one of you guys see ways to improved the text, please do. --[[User:Sblais2|Sblais2]] 14:29, 13 October 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
Well I feel like I&#039;m the only one in that team but...Anyway I&#039;ve completed the first 2 sections. Please try working on the next 4.  If you want to modify something, please post a small gist of it in here so we can all validate. Thanks. --[[User:Sblais2|Sblais2]] 20:10, 13 October 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
I am wondering if we have actually split up the work accordingly i am going to a temped to answer Information Maintenance if anyone has dibs please let me know - Csulliva&lt;br /&gt;
I am finding this site that I find very helpfull to understand system called for linux an UNIX &lt;br /&gt;
http://ss64.com/bash/&lt;br /&gt;
-Csulliva&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;ll do process control calls. and help out on the last part that is not written up yet.I&#039;ll read the other parts as well just to get an understanding. [[User:Apharan2|Apharan2]]&lt;br /&gt;
&lt;br /&gt;
Csullliva, be careful not to confuse system calls and shell commands. Some of them have actually the same name, like &#039;&#039;mkdir&#039;&#039;. But shell commands is on the user-level. Some of them will actually do system calls to complete the operation.&lt;br /&gt;
It&#039;s good to finally hear from you guys.--[[User:Sblais2|Sblais2]] 01:39, 14 October 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
I&#039;ll work on the communication calls and the miscellaneous system calls. Not sure if you guys wanted to add more to this, but I can help out with writing a conclusion as well. I&#039;m somewhat good at writing, so if i see any little things that I could touch up on, i&#039;ll help out with that.-R.arteaga&lt;br /&gt;
&lt;br /&gt;
after my confusion with bash and system calls i had some trouble find a  system calls for linux that would effect time here a web site I found that helped me out with description regarding the calls http://www.digilife.be/quickreferences/QRC/LINUX%20System%20Call%20Quick%20Reference.pdf&lt;br /&gt;
hopefully i am on the write track now....some one stop me if i am not -Csulliva&lt;br /&gt;
&lt;br /&gt;
Looks ok to me Csulliva, might want to check the link I posted in this discussion. It shows all the system calls in the Linux kernel 2.6.30. Then even show history information in it. It is then easy to track early Unix implementation. R.arteaga -&amp;gt; That would be great. I started thinking about a conclusion but writing is not my forte (unless I am underestimating myself). --[[User:Sblais2|Sblais2]] 11:59, 14 October 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
Also not to forget to add your references. I added mine in the reference section. --[[User:Sblais2|Sblais2]] 19:02, 14 October 2010 (UTC)&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_1_2010_Question_2&amp;diff=3956</id>
		<title>COMP 3000 Essay 1 2010 Question 2</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_1_2010_Question_2&amp;diff=3956"/>
		<updated>2010-10-14T18:57:47Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Question=&lt;br /&gt;
How do the available system calls in modern versions of the Linux Kernel (2.6.30+) compare with the system calls available in the earliest versions of UNIX? How has the system call interface been expanded, and why? Focus on major changes or extensions in functionality.&lt;br /&gt;
&lt;br /&gt;
=Answer=&lt;br /&gt;
&lt;br /&gt;
A system call is a mean by which programs in the user space can access kernel services. Systems calls vary from operating system to operating system, although the underlying concepts tends to be the same. In general, a process is not supposed to be able to access the kernel directly. It can&#039;t access kernel memory and it can&#039;t call kernel functions. When the CPU prevents a process from accessing the kernel, this prevention is commonly known as, the protected mode. On the other hand, system calls are an exception to this rule. For example, older x86 processors used an interrupt mechanism to go from user-space to kernel-space, but newer processor (PentiumII+) provided instructions that optimize this transition using sysenter and sysexit instructions (Hayward, Mike. Intel P6 vs P7 system call performance. [http://lkml.org/lkml/2002/12/9/13], December 9, 2002).  All system calls are small programs built using the C programming language.&lt;br /&gt;
&lt;br /&gt;
The Unix and Linux systems calls are roughly grouped into 6 major categories: file management, device management, information maintenance, process control, communications and miscellaneous calls. The miscellaneous calls are all the ones that don’t really fit in the other categories, like system calls dealing with errors. Today, the Unix and Linux operating system contains hundreds of system calls but in general, they all came from the 35 system calls that came with one of the original UNIX OS in the early 70s. In the next paragraphs, we’re going to describe the various system calls in each of the categories mentioned above, their evolution through history (major changes in functionality) and a comparison with the earliest versions of UNIX.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== File Management Calls==&lt;br /&gt;
&lt;br /&gt;
The system calls in this group deal with every type of operation that is required to run a file system in the operating system. Create file, delete file, opening a file and closing a file are just a few examples of them and most of them hardly changed throughout the years. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;chmod&#039;&#039;, &#039;&#039;chown&#039;&#039; and &#039;&#039;chdir&#039;&#039; has been available since the first original UNIX (1971) and it is still used in today’s Linux kernels. The &#039;&#039;chmod&#039;&#039; and &#039;&#039;chown&#039;&#039; calls allows the users to change the file attributes and implements security to the file system. The system call &#039;&#039;chdir&#039;&#039; allows the process to change the current working directory. In the 4th distribution of UNIX from Berkeley (4BSD), new system calls were added to be able to give more control on the file system to the applications. The call &#039;&#039;chroot&#039;&#039;  allows the process to change the current root directory with one specified in a path argument. &#039;&#039;fchmod&#039;&#039; and &#039;&#039;fchdir&#039;&#039; are the same as &#039;&#039;chmod&#039;&#039; and &#039;&#039;chdir&#039;&#039; except it takes file descriptors as arguments. As of Linux kernel 2.1.81, the &#039;&#039;chown&#039;&#039; system call follows symbolic link and introduce a new system call, &#039;&#039;lchown&#039;&#039;, that does not follow symbolic links.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another four of the original UNIX system calls are &#039;&#039;open&#039;&#039;, &#039;&#039;creat&#039;&#039;, &#039;&#039;mkdir&#039;&#039; and &#039;&#039;close&#039;&#039;. The &#039;&#039;open&#039;&#039; and &#039;&#039;creat&#039;&#039; calls allows processes to open and possibly create a file or device. Arguments flags are used to set either access modes, like O_RDONLY(read-only), to status flags, like O_APPEND(append mode). The only modifications made to the system calls were the addition of status flags where some of them are only linux-specific. The &#039;&#039;close&#039;&#039; call allows processes to close a file descriptor preventing it to be reused. No changes were made to it. &#039;&#039;mkdir&#039;&#039; allows the creation of a file directory. At that point, to delete a directory, users would need to make a series of &#039;&#039;link&#039;&#039; and &#039;&#039;unlink&#039;&#039; system calls. With Unix 4.2BSD, &#039;&#039;rmdir&#039;&#039; and solved the problem. The &#039;&#039;rename&#039;&#039; call was also added in 4.2BSD allowing processes to change the name or the location of a file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is also system calls used to find, access and modify files. They are ’‘read’’, ‘‘write’’, ‘‘seek’’ and ‘‘stat’’. These were all part of earliest UNIX built. The ‘‘read’’ and ‘‘write’’ system calls allows to read and write from a file (assigned to a file descriptor). The only change was in SVR4 where a write can be interrupted at anytime. The ‘‘seek’’ system calls is used to go to a specified position in a file. This calls used a 16 bit address. But this was replaced very quickly for ‘‘lseek’’ as early as SVR4. It allows the call to use 32 bit addresses. It is still used in modern Linux and Unix systems even if developers are trying to implement ‘‘lseek64’’, a system call that will use 64 bit addresses. The ‘‘stat’’ system calls allows processes to get the status of a file. With SVR4, 2 other version of that system call were created: ‘‘fstat’’ and ‘‘lstat’’. They both do the same thing except ‘‘lstat’’ give the status of symbolic links and ‘‘fstat’’ give the status of a file specified by a file descriptor. Different operating systems will output different values to represent the state of a file. Since kernel 2.5.48, the stat returned a nanoseconds field in the file’s timestamp. With the release of 4.4BSD, two new system calls called ‘‘statvfs’’ and ‘‘fstatvfs’’ were introduced to provide information about a mounted file system. They both do the same thing except fstatvfs takes file descriptors as an argument. These calls are only used in an UNIX environment. In Linux, it has ‘‘statfs’’ and ‘‘fstatfs’’ to support that same call.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last two original UNIX system calls in this category that are still used today are &#039;&#039;link&#039;&#039; and &#039;&#039;unlink&#039;&#039;. &#039;&#039;link&#039;&#039; creates a hard link to an existing file and &#039;&#039;unlink&#039;&#039; deletes a file link’s name and possibly the file it refers to. If the name refers to a symbolic link, only the link is removed. No major changes were done to the &#039;&#039;unlink&#039;&#039; system calls but new system calls were create from &#039;&#039;link&#039;&#039;. The &#039;&#039;symlink&#039;&#039; system call was added in 4.2BSD to allow the creation of symbolic links in the file system. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the Linux 2.6.16 build, multiple system calls were created so that the calls could deal with relative pathnames as arguments. They can easily be spotted as the system call names all finish with &#039;at&#039;. Here is a sample list of the created system calls: &#039;&#039;openat&#039;&#039;, &#039;&#039;mkdirat&#039;&#039;, &#039;&#039;fchmodat&#039;&#039;, &#039;&#039;fchownat&#039;&#039;, &#039;&#039;fstatat&#039;&#039;, &#039;&#039;linkat&#039;&#039;, &#039;&#039;unlinkat&#039;&#039;, &#039;&#039;renameat&#039;&#039; and &#039;&#039;fchmodat&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Device Management Calls==&lt;br /&gt;
&lt;br /&gt;
The device management system calls are linked to hardware and they are mainly used to requests for devices, release devices, to logically attach a device or to detach it, get and modified device attributes and read and write to them. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two of the most important system calls for the UNIX and Linux operating system is ‘‘mount’’ and ‘‘umount’’. These were among the few system calls available in UNIX in the 70s. The two calls allowed the operating system to load file systems on storage devices. A few changes were done to the mount system calls most of them were the creation of new mount flags to enhance performance. For example, since Linux 2.5.19, the MS_DIRSYNC flag permits the directory changes on a file system synchronous. Another Linux improvement was to provide per-process mount namespaces. This was added on the 2.4.19 kernel. If a process was created using clone() with the CLONE_NEWNS flag, the process will have a new namespace initialized to be a copy of the namespace of the process that was cloned. The ‘‘umount’’ system call unmounted the file system from the storage device. The only noteworthy change to ‘‘umount’’ was the creation of ‘‘umount2’’ in Linux 2.1.116. It is the same as ‘‘umount’’ except it allows different flags to control the operation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The ‘‘open’’, ‘‘read’’ and ‘‘write’’ calls can also be used to access devices. As discussed in the previous section, arguments flags are used to better control the device. You would use them as if the devices were files using the appropriate flags.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With the System V Unix revision 4(SVR4) came the system call ‘‘mmap’’. This system call is used to map or unmap files or devices into memory. Once a device is mapped, the system call returns a pointer to the mapped area allowing processes to access that device. This system call is still used in a Unix environment but since Linux 2.4, Linux replaced it by the mmap2 system call. It is basically the same as mmap except for a final argument specifying the offset into a file in 4096-byte units. This enables the mapping of large files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In version 7 of Unix, ‘‘ioctl’’ system call is used for device-specific operations that can’t be done using the standard system calls. This helps to deal with a multitude of devices. Each device drivers would provide a set of ioctl request code to allow various operations on their device. Each various request code are hardware dependent so there is no standard available for this system call.&lt;br /&gt;
&lt;br /&gt;
== Information Maintenance Calls==&lt;br /&gt;
Information maintenance calls are system calls that return the computers personal information back to the user or change it completely. These type of calls can be split up into three groups get/set time or date, get/set system data and get/set process,file, or device attributes. To fully understand the difference between Linux and UNIX in regrades to system call one must explore the three sub type of information maintenance calls and see how they have changed over time.&lt;br /&gt;
&lt;br /&gt;
The First sub type is Get/set of time and/or date, in Linux this can be done by a few different system call, there is: &#039;gettimeofday&#039; to get the time, &#039;settimeofday&#039; to set it, &#039;time&#039; returns the time in seconds. The earliest versions UNIX used the system call &#039;stime&#039; to interacted with time and dates. Stime could return the time and date and sets the system’s idea of the time and date by altering the seconds. &#039;stime&#039; is still being used by Linux because it is successful, unlike &#039;settimeofday&#039; which was created to change timezones (tz_dsttime) as well as the time but each occurrence of this field in the kernel source(apart for declaration) is a bug thus failing. (come back to) &lt;br /&gt;
&lt;br /&gt;
The second sub type is get/set system data. UNIX does this by....&lt;br /&gt;
&lt;br /&gt;
== Process Control Calls==&lt;br /&gt;
&lt;br /&gt;
== Communications Calls==&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous System Calls ==&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
Salus, Peter H. A Quarter Century of Unix, Publisher: Addison-Wesly Professional, June 10, 1994.&lt;br /&gt;
&lt;br /&gt;
Unix Programming Manual, http://cm.bell-labs.com/cm/cs/who/dmr/1stEdman.html, November 3, 1971.&lt;br /&gt;
&lt;br /&gt;
BSD System Calls Manual. http://www.unix.com/man-page/FreeBSD/2/,  The Unix and Linux Forums.&lt;br /&gt;
&lt;br /&gt;
Linux Programmer&#039;s Manual, Linux man-pages project.&lt;br /&gt;
http://www.kernel.org/doc/man-pages/&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_1_2010_Question_2&amp;diff=3955</id>
		<title>COMP 3000 Essay 1 2010 Question 2</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_1_2010_Question_2&amp;diff=3955"/>
		<updated>2010-10-14T18:57:19Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Question=&lt;br /&gt;
How do the available system calls in modern versions of the Linux Kernel (2.6.30+) compare with the system calls available in the earliest versions of UNIX? How has the system call interface been expanded, and why? Focus on major changes or extensions in functionality.&lt;br /&gt;
&lt;br /&gt;
=Answer=&lt;br /&gt;
&lt;br /&gt;
A system call is a mean by which programs in the user space can access kernel services. Systems calls vary from operating system to operating system, although the underlying concepts tends to be the same. In general, a process is not supposed to be able to access the kernel directly. It can&#039;t access kernel memory and it can&#039;t call kernel functions. When the CPU prevents a process from accessing the kernel, this prevention is commonly known as, the protected mode. On the other hand, system calls are an exception to this rule. For example, older x86 processors used an interrupt mechanism to go from user-space to kernel-space, but newer processor (PentiumII+) provided instructions that optimize this transition using sysenter and sysexit instructions (Hayward, Mike. Intel P6 vs P7 system call performance. [http://lkml.org/lkml/2002/12/9/13], December 9, 2002).  All system calls are small programs built using the C programming language.&lt;br /&gt;
&lt;br /&gt;
The Unix and Linux systems calls are roughly grouped into 6 major categories: file management, device management, information maintenance, process control, communications and miscellaneous calls. The miscellaneous calls are all the ones that don’t really fit in the other categories, like system calls dealing with errors. Today, the Unix and Linux operating system contains hundreds of system calls but in general, they all came from the 35 system calls that came with one of the original UNIX OS in the early 70s. In the next paragraphs, we’re going to describe the various system calls in each of the categories mentioned above, their evolution through history (major changes in functionality) and a comparison with the earliest versions of UNIX.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== File Management Calls==&lt;br /&gt;
&lt;br /&gt;
The system calls in this group deal with every type of operation that is required to run a file system in the operating system. Create file, delete file, opening a file and closing a file are just a few examples of them and most of them hardly changed throughout the years. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;chmod&#039;&#039;, &#039;&#039;chown&#039;&#039; and &#039;&#039;chdir&#039;&#039; has been available since the first original UNIX (1971) and it is still used in today’s Linux kernels. The &#039;&#039;chmod&#039;&#039; and &#039;&#039;chown&#039;&#039; calls allows the users to change the file attributes and implements security to the file system. The system call &#039;&#039;chdir&#039;&#039; allows the process to change the current working directory. In the 4th distribution of UNIX from Berkeley (4BSD), new system calls were added to be able to give more control on the file system to the applications. The call &#039;&#039;chroot&#039;&#039;  allows the process to change the current root directory with one specified in a path argument. &#039;&#039;fchmod&#039;&#039; and &#039;&#039;fchdir&#039;&#039; are the same as &#039;&#039;chmod&#039;&#039; and &#039;&#039;chdir&#039;&#039; except it takes file descriptors as arguments. As of Linux kernel 2.1.81, the &#039;&#039;chown&#039;&#039; system call follows symbolic link and introduce a new system call, &#039;&#039;lchown&#039;&#039;, that does not follow symbolic links.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another four of the original UNIX system calls are &#039;&#039;open&#039;&#039;, &#039;&#039;creat&#039;&#039;, &#039;&#039;mkdir&#039;&#039; and &#039;&#039;close&#039;&#039;. The &#039;&#039;open&#039;&#039; and &#039;&#039;creat&#039;&#039; calls allows processes to open and possibly create a file or device. Arguments flags are used to set either access modes, like O_RDONLY(read-only), to status flags, like O_APPEND(append mode). The only modifications made to the system calls were the addition of status flags where some of them are only linux-specific. The &#039;&#039;close&#039;&#039; call allows processes to close a file descriptor preventing it to be reused. No changes were made to it. &#039;&#039;mkdir&#039;&#039; allows the creation of a file directory. At that point, to delete a directory, users would need to make a series of &#039;&#039;link&#039;&#039; and &#039;&#039;unlink&#039;&#039; system calls. With Unix 4.2BSD, &#039;&#039;rmdir&#039;&#039; and solved the problem. The &#039;&#039;rename&#039;&#039; call was also added in 4.2BSD allowing processes to change the name or the location of a file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is also system calls used to find, access and modify files. They are ’‘read’’, ‘‘write’’, ‘‘seek’’ and ‘‘stat’’. These were all part of earliest UNIX built. The ‘‘read’’ and ‘‘write’’ system calls allows to read and write from a file (assigned to a file descriptor). The only change was in SVR4 where a write can be interrupted at anytime. The ‘‘seek’’ system calls is used to go to a specified position in a file. This calls used a 16 bit address. But this was replaced very quickly for ‘‘lseek’’ as early as SVR4. It allows the call to use 32 bit addresses. It is still used in modern Linux and Unix systems even if developers are trying to implement ‘‘lseek64’’, a system call that will use 64 bit addresses. The ‘‘stat’’ system calls allows processes to get the status of a file. With SVR4, 2 other version of that system call were created: ‘‘fstat’’ and ‘‘lstat’’. They both do the same thing except ‘‘lstat’’ give the status of symbolic links and ‘‘fstat’’ give the status of a file specified by a file descriptor. Different operating systems will output different values to represent the state of a file. Since kernel 2.5.48, the stat returned a nanoseconds field in the file’s timestamp. With the release of 4.4BSD, two new system calls called ‘‘statvfs’’ and ‘‘fstatvfs’’ were introduced to provide information about a mounted file system. They both do the same thing except fstatvfs takes file descriptors as an argument. These calls are only used in an UNIX environment. In Linux, it has ‘‘statfs’’ and ‘‘fstatfs’’ to support that same call.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last two original UNIX system calls in this category that are still used today are &#039;&#039;link&#039;&#039; and &#039;&#039;unlink&#039;&#039;. &#039;&#039;link&#039;&#039; creates a hard link to an existing file and &#039;&#039;unlink&#039;&#039; deletes a file link’s name and possibly the file it refers to. If the name refers to a symbolic link, only the link is removed. No major changes were done to the &#039;&#039;unlink&#039;&#039; system calls but new system calls were create from &#039;&#039;link&#039;&#039;. The &#039;&#039;symlink&#039;&#039; system call was added in 4.2BSD to allow the creation of symbolic links in the file system. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the Linux 2.6.16 build, multiple system calls were created so that the calls could deal with relative pathnames as arguments. They can easily be spotted as the system call names all finish with &#039;at&#039;. Here is a sample list of the created system calls: &#039;&#039;openat&#039;&#039;, &#039;&#039;mkdirat&#039;&#039;, &#039;&#039;fchmodat&#039;&#039;, &#039;&#039;fchownat&#039;&#039;, &#039;&#039;fstatat&#039;&#039;, &#039;&#039;linkat&#039;&#039;, &#039;&#039;unlinkat&#039;&#039;, &#039;&#039;renameat&#039;&#039; and &#039;&#039;fchmodat&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Device Management Calls==&lt;br /&gt;
&lt;br /&gt;
The device management system calls are linked to hardware and they are mainly used to requests for devices, release devices, to logically attach a device or to detach it, get and modified device attributes and read and write to them. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two of the most important system calls for the UNIX and Linux operating system is ‘‘mount’’ and ‘‘umount’’. These were among the few system calls available in UNIX in the 70s. The two calls allowed the operating system to load file systems on storage devices. A few changes were done to the mount system calls most of them were the creation of new mount flags to enhance performance. For example, since Linux 2.5.19, the MS_DIRSYNC flag permits the directory changes on a file system synchronous. Another Linux improvement was to provide per-process mount namespaces. This was added on the 2.4.19 kernel. If a process was created using clone() with the CLONE_NEWNS flag, the process will have a new namespace initialized to be a copy of the namespace of the process that was cloned. The ‘‘umount’’ system call unmounted the file system from the storage device. The only noteworthy change to ‘‘umount’’ was the creation of ‘‘umount2’’ in Linux 2.1.116. It is the same as ‘‘umount’’ except it allows different flags to control the operation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The ‘‘open’’, ‘‘read’’ and ‘‘write’’ calls can also be used to access devices. As discussed in the previous section, arguments flags are used to better control the device. You would use them as if the devices were files using the appropriate flags.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With the System V Unix revision 4(SVR4) came the system call ‘‘mmap’’. This system call is used to map or unmap files or devices into memory. Once a device is mapped, the system call returns a pointer to the mapped area allowing processes to access that device. This system call is still used in a Unix environment but since Linux 2.4, Linux replaced it by the mmap2 system call. It is basically the same as mmap except for a final argument specifying the offset into a file in 4096-byte units. This enables the mapping of large files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In version 7 of Unix, ‘‘ioctl’’ system call is used for device-specific operations that can’t be done using the standard system calls. This helps to deal with a multitude of devices. Each device drivers would provide a set of ioctl request code to allow various operations on their device. Each various request code are hardware dependent so there is no standard available for this system call.&lt;br /&gt;
&lt;br /&gt;
== Information Maintenance Calls==&lt;br /&gt;
Information maintenance calls are system calls that return the computers personal information back to the user or change it completely. These type of calls can be split up into three groups get/set time or date, get/set system data and get/set process,file, or device attributes. To fully understand the difference between Linux and UNIX in regrades to system call one must explore the three sub type of information maintenance calls and see how they have changed over time.&lt;br /&gt;
&lt;br /&gt;
The First sub type is Get/set of time and/or date, in Linux this can be done by a few different system call, there is: &#039;gettimeofday&#039; to get the time, &#039;settimeofday&#039; to set it, &#039;time&#039; returns the time in seconds. The earliest versions UNIX used the system call &#039;stime&#039; to interacted with time and dates. Stime could return the time and date and sets the system’s idea of the time and date by altering the seconds. &#039;stime&#039; is still being used by Linux because it is successful, unlike &#039;settimeofday&#039; which was created to change timezones (tz_dsttime) as well as the time but each occurrence of this field in the kernel source(apart for declaration) is a bug thus failing. (come back to) &lt;br /&gt;
&lt;br /&gt;
The second sub type is get/set system data. UNIX does this by....&lt;br /&gt;
&lt;br /&gt;
== Process Control Calls==&lt;br /&gt;
&lt;br /&gt;
== Communications Calls==&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous System Calls ==&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
Salus, Peter H. A Quarter Century of Unix, Publisher: Addison-Wesly Professional, June 10, 1994.&lt;br /&gt;
&lt;br /&gt;
Unix Programming Manual, http://cm.bell-labs.com/cm/cs/who/dmr/1stEdman.html, November 3, 1971.&lt;br /&gt;
&lt;br /&gt;
BSD System Calls Manual. [http://www.unix.com/man-page/FreeBSD/2/] The Unix and Linux Forums.&lt;br /&gt;
&lt;br /&gt;
Linux Programmer&#039;s Manual, Linux man-pages project.&lt;br /&gt;
http://www.kernel.org/doc/man-pages/&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_1_2010_Question_2&amp;diff=3947</id>
		<title>COMP 3000 Essay 1 2010 Question 2</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_1_2010_Question_2&amp;diff=3947"/>
		<updated>2010-10-14T18:51:56Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: /* File Management Calls */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Question=&lt;br /&gt;
How do the available system calls in modern versions of the Linux Kernel (2.6.30+) compare with the system calls available in the earliest versions of UNIX? How has the system call interface been expanded, and why? Focus on major changes or extensions in functionality.&lt;br /&gt;
&lt;br /&gt;
=Answer=&lt;br /&gt;
&lt;br /&gt;
A system call is a mean by which programs in the user space can access kernel services. Systems calls vary from operating system to operating system, although the underlying concepts tends to be the same. In general, a process is not supposed to be able to access the kernel directly. It can&#039;t access kernel memory and it can&#039;t call kernel functions. When the CPU prevents a process from accessing the kernel, this prevention is commonly known as, the protected mode. On the other hand, system calls are an exception to this rule. For example, older x86 processors used an interrupt mechanism to go from user-space to kernel-space, but newer processor (PentiumII+) provided instructions that optimize this transition using sysenter and sysexit instructions (Hayward, Mike. Intel P6 vs P7 system call performance. [http://lkml.org/lkml/2002/12/9/13], December 9, 2002).  All system calls are small programs built using the C programming language.&lt;br /&gt;
&lt;br /&gt;
The Unix and Linux systems calls are roughly grouped into 6 major categories: file management, device management, information maintenance, process control, communications and miscellaneous calls. The miscellaneous calls are all the ones that don’t really fit in the other categories, like system calls dealing with errors. Today, the Unix and Linux operating system contains hundreds of system calls but in general, they all came from the 35 system calls that came with one of the original UNIX OS in the early 70s. In the next paragraphs, we’re going to describe the various system calls in each of the categories mentioned above, their evolution through history (major changes in functionality) and a comparison with the earliest versions of UNIX.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== File Management Calls==&lt;br /&gt;
&lt;br /&gt;
The system calls in this group deal with every type of operation that is required to run a file system in the operating system. Create file, delete file, opening a file and closing a file are just a few examples of them and most of them hardly changed throughout the years. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;chmod&#039;&#039;, &#039;&#039;chown&#039;&#039; and &#039;&#039;chdir&#039;&#039; has been available since the first original UNIX (1971) and it is still used in today’s Linux kernels. The &#039;&#039;chmod&#039;&#039; and &#039;&#039;chown&#039;&#039; calls allows the users to change the file attributes and implements security to the file system. The system call &#039;&#039;chdir&#039;&#039; allows the process to change the current working directory. In the 4th distribution of UNIX from Berkeley (4BSD), new system calls were added to be able to give more control on the file system to the applications. The call &#039;&#039;chroot&#039;&#039;  allows the process to change the current root directory with one specified in a path argument. &#039;&#039;fchmod&#039;&#039; and &#039;&#039;fchdir&#039;&#039; are the same as &#039;&#039;chmod&#039;&#039; and &#039;&#039;chdir&#039;&#039; except it takes file descriptors as arguments. As of Linux kernel 2.1.81, the &#039;&#039;chown&#039;&#039; system call follows symbolic link and introduce a new system call, &#039;&#039;lchown&#039;&#039;, that does not follow symbolic links.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another four of the original UNIX system calls are &#039;&#039;open&#039;&#039;, &#039;&#039;creat&#039;&#039;, &#039;&#039;mkdir&#039;&#039; and &#039;&#039;close&#039;&#039;. The &#039;&#039;open&#039;&#039; and &#039;&#039;creat&#039;&#039; calls allows processes to open and possibly create a file or device. Arguments flags are used to set either access modes, like O_RDONLY(read-only), to status flags, like O_APPEND(append mode). The only modifications made to the system calls were the addition of status flags where some of them are only linux-specific. The &#039;&#039;close&#039;&#039; call allows processes to close a file descriptor preventing it to be reused. No changes were made to it. &#039;&#039;mkdir&#039;&#039; allows the creation of a file directory. At that point, to delete a directory, users would need to make a series of &#039;&#039;link&#039;&#039; and &#039;&#039;unlink&#039;&#039; system calls. With Unix 4.2BSD, &#039;&#039;rmdir&#039;&#039; and solved the problem. The &#039;&#039;rename&#039;&#039; call was also added in 4.2BSD allowing processes to change the name or the location of a file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is also system calls used to find, access and modify files. They are ’‘read’’, ‘‘write’’, ‘‘seek’’ and ‘‘stat’’. These were all part of earliest UNIX built. The ‘‘read’’ and ‘‘write’’ system calls allows to read and write from a file (assigned to a file descriptor). The only change was in SVR4 where a write can be interrupted at anytime. The ‘‘seek’’ system calls is used to go to a specified position in a file. This calls used a 16 bit address. But this was replaced very quickly for ‘‘lseek’’ as early as SVR4. It allows the call to use 32 bit addresses. It is still used in modern Linux and Unix systems even if developers are trying to implement ‘‘lseek64’’, a system call that will use 64 bit addresses. The ‘‘stat’’ system calls allows processes to get the status of a file. With SVR4, 2 other version of that system call were created: ‘‘fstat’’ and ‘‘lstat’’. They both do the same thing except ‘‘lstat’’ give the status of symbolic links and ‘‘fstat’’ give the status of a file specified by a file descriptor. Different operating systems will output different values to represent the state of a file. Since kernel 2.5.48, the stat returned a nanoseconds field in the file’s timestamp. With the release of 4.4BSD, two new system calls called ‘‘statvfs’’ and ‘‘fstatvfs’’ were introduced to provide information about a mounted file system. They both do the same thing except fstatvfs takes file descriptors as an argument. These calls are only used in an UNIX environment. In Linux, it has ‘‘statfs’’ and ‘‘fstatfs’’ to support that same call.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last two original UNIX system calls in this category that are still used today are &#039;&#039;link&#039;&#039; and &#039;&#039;unlink&#039;&#039;. &#039;&#039;link&#039;&#039; creates a hard link to an existing file and &#039;&#039;unlink&#039;&#039; deletes a file link’s name and possibly the file it refers to. If the name refers to a symbolic link, only the link is removed. No major changes were done to the &#039;&#039;unlink&#039;&#039; system calls but new system calls were create from &#039;&#039;link&#039;&#039;. The &#039;&#039;symlink&#039;&#039; system call was added in 4.2BSD to allow the creation of symbolic links in the file system. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the Linux 2.6.16 build, multiple system calls were created so that the calls could deal with relative pathnames as arguments. They can easily be spotted as the system call names all finish with &#039;at&#039;. Here is a sample list of the created system calls: &#039;&#039;openat&#039;&#039;, &#039;&#039;mkdirat&#039;&#039;, &#039;&#039;fchmodat&#039;&#039;, &#039;&#039;fchownat&#039;&#039;, &#039;&#039;fstatat&#039;&#039;, &#039;&#039;linkat&#039;&#039;, &#039;&#039;unlinkat&#039;&#039;, &#039;&#039;renameat&#039;&#039; and &#039;&#039;fchmodat&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Device Management Calls==&lt;br /&gt;
&lt;br /&gt;
The device management system calls are linked to hardware and they are mainly used to requests for devices, release devices, to logically attach a device or to detach it, get and modified device attributes and read and write to them. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two of the most important system calls for the UNIX and Linux operating system is ‘‘mount’’ and ‘‘umount’’. These were among the few system calls available in UNIX in the 70s. The two calls allowed the operating system to load file systems on storage devices. A few changes were done to the mount system calls most of them were the creation of new mount flags to enhance performance. For example, since Linux 2.5.19, the MS_DIRSYNC flag permits the directory changes on a file system synchronous. Another Linux improvement was to provide per-process mount namespaces. This was added on the 2.4.19 kernel. If a process was created using clone() with the CLONE_NEWNS flag, the process will have a new namespace initialized to be a copy of the namespace of the process that was cloned. The ‘‘umount’’ system call unmounted the file system from the storage device. The only noteworthy change to ‘‘umount’’ was the creation of ‘‘umount2’’ in Linux 2.1.116. It is the same as ‘‘umount’’ except it allows different flags to control the operation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The ‘‘open’’, ‘‘read’’ and ‘‘write’’ calls can also be used to access devices. As discussed in the previous section, arguments flags are used to better control the device. You would use them as if the devices were files using the appropriate flags.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With the System V Unix revision 4(SVR4) came the system call ‘‘mmap’’. This system call is used to map or unmap files or devices into memory. Once a device is mapped, the system call returns a pointer to the mapped area allowing processes to access that device. This system call is still used in a Unix environment but since Linux 2.4, Linux replaced it by the mmap2 system call. It is basically the same as mmap except for a final argument specifying the offset into a file in 4096-byte units. This enables the mapping of large files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In version 7 of Unix, ‘‘ioctl’’ system call is used for device-specific operations that can’t be done using the standard system calls. This helps to deal with a multitude of devices. Each device drivers would provide a set of ioctl request code to allow various operations on their device. Each various request code are hardware dependent so there is no standard available for this system call.&lt;br /&gt;
&lt;br /&gt;
== Information Maintenance Calls==&lt;br /&gt;
Information maintenance calls are system calls that return the computers personal information back to the user or change it completely. These type of calls can be split up into three groups get/set time or date, get/set system data and get/set process,file, or device attributes. To fully understand the difference between Linux and UNIX in regrades to system call one must explore the three sub type of information maintenance calls and see how they have changed over time.&lt;br /&gt;
&lt;br /&gt;
The First sub type is Get/set of time and/or date, in Linux this can be done by a few different system call, there is: &#039;gettimeofday&#039; to get the time, &#039;settimeofday&#039; to set it, &#039;time&#039; returns the time in seconds. The earliest versions UNIX used the system call &#039;stime&#039; to interacted with time and dates. Stime could return the time and date and sets the system’s idea of the time and date by altering the seconds. &#039;stime&#039; is still being used by Linux because it is successful, unlike &#039;settimeofday&#039; which was created to change timezones (tz_dsttime) as well as the time but each occurrence of this field in the kernel source(apart for declaration) is a bug thus failing. (come back to) &lt;br /&gt;
&lt;br /&gt;
The second sub type is get/set system data. UNIX does this by....&lt;br /&gt;
&lt;br /&gt;
== Process Control Calls==&lt;br /&gt;
&lt;br /&gt;
== Communications Calls==&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous System Calls ==&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
Salus, Peter H. A Quarter Century of Unix, Publisher: Addison-Wesly Professional, June 10, 1994.&lt;br /&gt;
&lt;br /&gt;
Unix Programming Manual, http://cm.bell-labs.com/cm/cs/who/dmr/1stEdman.html, November 3, 1971.&lt;br /&gt;
&lt;br /&gt;
Linux Programmer&#039;s Manual, Linux man-pages project.&lt;br /&gt;
http://www.kernel.org/doc/man-pages/&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_1_2010_Question_2&amp;diff=3946</id>
		<title>COMP 3000 Essay 1 2010 Question 2</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_1_2010_Question_2&amp;diff=3946"/>
		<updated>2010-10-14T18:50:49Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: /* File Management Calls */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Question=&lt;br /&gt;
How do the available system calls in modern versions of the Linux Kernel (2.6.30+) compare with the system calls available in the earliest versions of UNIX? How has the system call interface been expanded, and why? Focus on major changes or extensions in functionality.&lt;br /&gt;
&lt;br /&gt;
=Answer=&lt;br /&gt;
&lt;br /&gt;
A system call is a mean by which programs in the user space can access kernel services. Systems calls vary from operating system to operating system, although the underlying concepts tends to be the same. In general, a process is not supposed to be able to access the kernel directly. It can&#039;t access kernel memory and it can&#039;t call kernel functions. When the CPU prevents a process from accessing the kernel, this prevention is commonly known as, the protected mode. On the other hand, system calls are an exception to this rule. For example, older x86 processors used an interrupt mechanism to go from user-space to kernel-space, but newer processor (PentiumII+) provided instructions that optimize this transition using sysenter and sysexit instructions (Hayward, Mike. Intel P6 vs P7 system call performance. [http://lkml.org/lkml/2002/12/9/13], December 9, 2002).  All system calls are small programs built using the C programming language.&lt;br /&gt;
&lt;br /&gt;
The Unix and Linux systems calls are roughly grouped into 6 major categories: file management, device management, information maintenance, process control, communications and miscellaneous calls. The miscellaneous calls are all the ones that don’t really fit in the other categories, like system calls dealing with errors. Today, the Unix and Linux operating system contains hundreds of system calls but in general, they all came from the 35 system calls that came with one of the original UNIX OS in the early 70s. In the next paragraphs, we’re going to describe the various system calls in each of the categories mentioned above, their evolution through history (major changes in functionality) and a comparison with the earliest versions of UNIX.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== File Management Calls==&lt;br /&gt;
&lt;br /&gt;
The system calls in this group deal with every type of operation that is required to run a file system in the operating system. Create file, delete file, opening a file and closing a file are just a few examples of them and most of them hardly changed throughout the years. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;chmod&#039;&#039;, &#039;&#039;chown&#039;&#039; and &#039;&#039;chdir&#039;&#039; has been available since the first original UNIX (1971) and it is still used in today’s Linux kernels. The &#039;&#039;chmod&#039;&#039; and &#039;&#039;chown&#039;&#039; calls allows the users to change the file attributes and implements security to the file system. The system call &#039;&#039;chdir&#039;&#039; allows the process to change the current working directory. In the 4th distribution of UNIX from Berkeley (4BSD), new system calls were added to be able to give more control on the file system to the applications. The call &#039;&#039;chroot&#039;&#039; [http://www.manpagez.com/man/2/chroot/] allows the process to change the current root directory with one specified in a path argument. &#039;&#039;fchmod&#039;&#039; and &#039;&#039;fchdir&#039;&#039; are the same as &#039;&#039;chmod&#039;&#039; and &#039;&#039;chdir&#039;&#039; except it takes file descriptors as arguments. As of Linux kernel 2.1.81, the &#039;&#039;chown&#039;&#039; system call follows symbolic link and introduce a new system call, &#039;&#039;lchown&#039;&#039;, that does not follow symbolic links.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another four of the original UNIX system calls are &#039;&#039;open&#039;&#039;, &#039;&#039;creat&#039;&#039;, &#039;&#039;mkdir&#039;&#039; and &#039;&#039;close&#039;&#039;. The &#039;&#039;open&#039;&#039; and &#039;&#039;creat&#039;&#039; calls allows processes to open and possibly create a file or device. Arguments flags are used to set either access modes, like O_RDONLY(read-only), to status flags, like O_APPEND(append mode). The only modifications made to the system calls were the addition of status flags where some of them are only linux-specific. The &#039;&#039;close&#039;&#039; call allows processes to close a file descriptor preventing it to be reused. No changes were made to it. &#039;&#039;mkdir&#039;&#039; allows the creation of a file directory. At that point, to delete a directory, users would need to make a series of &#039;&#039;link&#039;&#039; and &#039;&#039;unlink&#039;&#039; system calls. With Unix 4.2BSD, &#039;&#039;rmdir&#039;&#039; and solved the problem. The &#039;&#039;rename&#039;&#039; call was also added in 4.2BSD allowing processes to change the name or the location of a file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is also system calls used to find, access and modify files. They are ’‘read’’, ‘‘write’’, ‘‘seek’’ and ‘‘stat’’. These were all part of earliest UNIX built. The ‘‘read’’ and ‘‘write’’ system calls allows to read and write from a file (assigned to a file descriptor). The only change was in SVR4 where a write can be interrupted at anytime. The ‘‘seek’’ system calls is used to go to a specified position in a file. This calls used a 16 bit address. But this was replaced very quickly for ‘‘lseek’’ as early as SVR4. It allows the call to use 32 bit addresses. It is still used in modern Linux and Unix systems even if developers are trying to implement ‘‘lseek64’’, a system call that will use 64 bit addresses. The ‘‘stat’’ system calls allows processes to get the status of a file. With SVR4, 2 other version of that system call were created: ‘‘fstat’’ and ‘‘lstat’’. They both do the same thing except ‘‘lstat’’ give the status of symbolic links and ‘‘fstat’’ give the status of a file specified by a file descriptor. Different operating systems will output different values to represent the state of a file. Since kernel 2.5.48, the stat returned a nanoseconds field in the file’s timestamp. With the release of 4.4BSD, two new system calls called ‘‘statvfs’’ and ‘‘fstatvfs’’ were introduced to provide information about a mounted file system. They both do the same thing except fstatvfs takes file descriptors as an argument. These calls are only used in an UNIX environment. In Linux, it has ‘‘statfs’’ and ‘‘fstatfs’’ to support that same call.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last two original UNIX system calls in this category that are still used today are &#039;&#039;link&#039;&#039; and &#039;&#039;unlink&#039;&#039;. &#039;&#039;link&#039;&#039; creates a hard link to an existing file and &#039;&#039;unlink&#039;&#039; deletes a file link’s name and possibly the file it refers to. If the name refers to a symbolic link, only the link is removed. No major changes were done to the &#039;&#039;unlink&#039;&#039; system calls but new system calls were create from &#039;&#039;link&#039;&#039;. The &#039;&#039;symlink&#039;&#039; system call was added in 4.2BSD to allow the creation of symbolic links in the file system. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the Linux 2.6.16 build, multiple system calls were created so that the calls could deal with relative pathnames as arguments. They can easily be spotted as the system call names all finish with &#039;at&#039;. Here is a sample list of the created system calls: &#039;&#039;openat&#039;&#039;, &#039;&#039;mkdirat&#039;&#039;, &#039;&#039;fchmodat&#039;&#039;, &#039;&#039;fchownat&#039;&#039;, &#039;&#039;fstatat&#039;&#039;, &#039;&#039;linkat&#039;&#039;, &#039;&#039;unlinkat&#039;&#039;, &#039;&#039;renameat&#039;&#039; and &#039;&#039;fchmodat&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Device Management Calls==&lt;br /&gt;
&lt;br /&gt;
The device management system calls are linked to hardware and they are mainly used to requests for devices, release devices, to logically attach a device or to detach it, get and modified device attributes and read and write to them. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two of the most important system calls for the UNIX and Linux operating system is ‘‘mount’’ and ‘‘umount’’. These were among the few system calls available in UNIX in the 70s. The two calls allowed the operating system to load file systems on storage devices. A few changes were done to the mount system calls most of them were the creation of new mount flags to enhance performance. For example, since Linux 2.5.19, the MS_DIRSYNC flag permits the directory changes on a file system synchronous. Another Linux improvement was to provide per-process mount namespaces. This was added on the 2.4.19 kernel. If a process was created using clone() with the CLONE_NEWNS flag, the process will have a new namespace initialized to be a copy of the namespace of the process that was cloned. The ‘‘umount’’ system call unmounted the file system from the storage device. The only noteworthy change to ‘‘umount’’ was the creation of ‘‘umount2’’ in Linux 2.1.116. It is the same as ‘‘umount’’ except it allows different flags to control the operation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The ‘‘open’’, ‘‘read’’ and ‘‘write’’ calls can also be used to access devices. As discussed in the previous section, arguments flags are used to better control the device. You would use them as if the devices were files using the appropriate flags.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With the System V Unix revision 4(SVR4) came the system call ‘‘mmap’’. This system call is used to map or unmap files or devices into memory. Once a device is mapped, the system call returns a pointer to the mapped area allowing processes to access that device. This system call is still used in a Unix environment but since Linux 2.4, Linux replaced it by the mmap2 system call. It is basically the same as mmap except for a final argument specifying the offset into a file in 4096-byte units. This enables the mapping of large files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In version 7 of Unix, ‘‘ioctl’’ system call is used for device-specific operations that can’t be done using the standard system calls. This helps to deal with a multitude of devices. Each device drivers would provide a set of ioctl request code to allow various operations on their device. Each various request code are hardware dependent so there is no standard available for this system call.&lt;br /&gt;
&lt;br /&gt;
== Information Maintenance Calls==&lt;br /&gt;
Information maintenance calls are system calls that return the computers personal information back to the user or change it completely. These type of calls can be split up into three groups get/set time or date, get/set system data and get/set process,file, or device attributes. To fully understand the difference between Linux and UNIX in regrades to system call one must explore the three sub type of information maintenance calls and see how they have changed over time.&lt;br /&gt;
&lt;br /&gt;
The First sub type is Get/set of time and/or date, in Linux this can be done by a few different system call, there is: &#039;gettimeofday&#039; to get the time, &#039;settimeofday&#039; to set it, &#039;time&#039; returns the time in seconds. The earliest versions UNIX used the system call &#039;stime&#039; to interacted with time and dates. Stime could return the time and date and sets the system’s idea of the time and date by altering the seconds. &#039;stime&#039; is still being used by Linux because it is successful, unlike &#039;settimeofday&#039; which was created to change timezones (tz_dsttime) as well as the time but each occurrence of this field in the kernel source(apart for declaration) is a bug thus failing. (come back to) &lt;br /&gt;
&lt;br /&gt;
The second sub type is get/set system data. UNIX does this by....&lt;br /&gt;
&lt;br /&gt;
== Process Control Calls==&lt;br /&gt;
&lt;br /&gt;
== Communications Calls==&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous System Calls ==&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
Salus, Peter H. A Quarter Century of Unix, Publisher: Addison-Wesly Professional, June 10, 1994.&lt;br /&gt;
&lt;br /&gt;
Unix Programming Manual, http://cm.bell-labs.com/cm/cs/who/dmr/1stEdman.html, November 3, 1971.&lt;br /&gt;
&lt;br /&gt;
Linux Programmer&#039;s Manual, Linux man-pages project.&lt;br /&gt;
http://www.kernel.org/doc/man-pages/&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_1_2010_Question_2&amp;diff=3938</id>
		<title>COMP 3000 Essay 1 2010 Question 2</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_1_2010_Question_2&amp;diff=3938"/>
		<updated>2010-10-14T18:44:23Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: /* File Management Calls */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Question=&lt;br /&gt;
How do the available system calls in modern versions of the Linux Kernel (2.6.30+) compare with the system calls available in the earliest versions of UNIX? How has the system call interface been expanded, and why? Focus on major changes or extensions in functionality.&lt;br /&gt;
&lt;br /&gt;
=Answer=&lt;br /&gt;
&lt;br /&gt;
A system call is a mean by which programs in the user space can access kernel services. Systems calls vary from operating system to operating system, although the underlying concepts tends to be the same. In general, a process is not supposed to be able to access the kernel directly. It can&#039;t access kernel memory and it can&#039;t call kernel functions. When the CPU prevents a process from accessing the kernel, this prevention is commonly known as, the protected mode. On the other hand, system calls are an exception to this rule. For example, older x86 processors used an interrupt mechanism to go from user-space to kernel-space, but newer processor (PentiumII+) provided instructions that optimize this transition using sysenter and sysexit instructions (Hayward, Mike. Intel P6 vs P7 system call performance. [http://lkml.org/lkml/2002/12/9/13], December 9, 2002).  All system calls are small programs built using the C programming language.&lt;br /&gt;
&lt;br /&gt;
The Unix and Linux systems calls are roughly grouped into 6 major categories: file management, device management, information maintenance, process control, communications and miscellaneous calls. The miscellaneous calls are all the ones that don’t really fit in the other categories, like system calls dealing with errors. Today, the Unix and Linux operating system contains hundreds of system calls but in general, they all came from the 35 system calls that came with one of the original UNIX OS in the early 70s. In the next paragraphs, we’re going to describe the various system calls in each of the categories mentioned above, their evolution through history (major changes in functionality) and a comparison with the earliest versions of UNIX.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== File Management Calls==&lt;br /&gt;
&lt;br /&gt;
The system calls in this group deal with every type of operation that is required to run a file system in the operating system. Create file, delete file, opening a file and closing a file are just a few examples of them and most of them hardly changed throughout the years. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;chmod&#039;&#039;, &#039;&#039;chown&#039;&#039; and &#039;&#039;chdir&#039;&#039; has been available since the first original UNIX (1971) and it is still used in today’s Linux kernels. The &#039;&#039;chmod&#039;&#039; and &#039;&#039;chown&#039;&#039; calls allows the users to change the file attributes and implements security to the file system. The system call &#039;&#039;chdir&#039;&#039; allows the process to change the current working directory. In the 4th distribution of UNIX from Berkeley (4BSD), new system calls were added to be able to give more control on the file system to the applications. The call &#039;&#039;chroot&#039;&#039; allows the process to change the current root directory with one specified in a path argument. &#039;&#039;fchmod&#039;&#039; and &#039;&#039;fchdir&#039;&#039; are the same as &#039;&#039;chmod&#039;&#039; and &#039;&#039;chdir&#039;&#039; except it takes file descriptors as arguments. As of Linux kernel 2.1.81, the &#039;&#039;chown&#039;&#039; system call follows symbolic link and introduce a new system call, &#039;&#039;lchown&#039;&#039;, that does not follow symbolic links.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another four of the original UNIX system calls are &#039;&#039;open&#039;&#039;, &#039;&#039;creat&#039;&#039;, &#039;&#039;mkdir&#039;&#039; and &#039;&#039;close&#039;&#039;. The &#039;&#039;open&#039;&#039; and &#039;&#039;creat&#039;&#039; calls allows processes to open and possibly create a file or device. Arguments flags are used to set either access modes, like O_RDONLY(read-only), to status flags, like O_APPEND(append mode). The only modifications made to the system calls were the addition of status flags where some of them are only linux-specific. The &#039;&#039;close&#039;&#039; call allows processes to close a file descriptor preventing it to be reused. No changes were made to it. &#039;&#039;mkdir&#039;&#039; allows the creation of a file directory. At that point, to delete a directory, users would need to make a series of &#039;&#039;link&#039;&#039; and &#039;&#039;unlink&#039;&#039; system calls. With Unix 4.2BSD, &#039;&#039;rmdir&#039;&#039; and solved the problem. The &#039;&#039;rename&#039;&#039; call was also added in 4.2BSD allowing processes to change the name or the location of a file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is also system calls used to find, access and modify files. They are ’‘read’’, ‘‘write’’, ‘‘seek’’ and ‘‘stat’’. These were all part of earliest UNIX built. The ‘‘read’’ and ‘‘write’’ system calls allows to read and write from a file (assigned to a file descriptor). The only change was in SVR4 where a write can be interrupted at anytime. The ‘‘seek’’ system calls is used to go to a specified position in a file. This calls used a 16 bit address. But this was replaced very quickly for ‘‘lseek’’ as early as SVR4. It allows the call to use 32 bit addresses. It is still used in modern Linux and Unix systems even if developers are trying to implement ‘‘lseek64’’, a system call that will use 64 bit addresses. The ‘‘stat’’ system calls allows processes to get the status of a file. With SVR4, 2 other version of that system call were created: ‘‘fstat’’ and ‘‘lstat’’. They both do the same thing except ‘‘lstat’’ give the status of symbolic links and ‘‘fstat’’ give the status of a file specified by a file descriptor. Different operating systems will output different values to represent the state of a file. Since kernel 2.5.48, the stat returned a nanoseconds field in the file’s timestamp. With the release of 4.4BSD, two new system calls called ‘‘statvfs’’ and ‘‘fstatvfs’’ were introduced to provide information about a mounted file system. They both do the same thing except fstatvfs takes file descriptors as an argument. These calls are only used in an UNIX environment. In Linux, it has ‘‘statfs’’ and ‘‘fstatfs’’ to support that same call.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last two original UNIX system calls in this category that are still used today are &#039;&#039;link&#039;&#039; and &#039;&#039;unlink&#039;&#039;. &#039;&#039;link&#039;&#039; creates a hard link to an existing file and &#039;&#039;unlink&#039;&#039; deletes a file link’s name and possibly the file it refers to. If the name refers to a symbolic link, only the link is removed. No major changes were done to the &#039;&#039;unlink&#039;&#039; system calls but new system calls were create from &#039;&#039;link&#039;&#039;. The &#039;&#039;symlink&#039;&#039; system call was added in 4.2BSD to allow the creation of symbolic links in the file system. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the Linux 2.6.16 build, multiple system calls were created so that the calls could deal with relative pathnames as arguments. They can easily be spotted as the system call names all finish with &#039;at&#039;. Here is a sample list of the created system calls: &#039;&#039;openat&#039;&#039;, &#039;&#039;mkdirat&#039;&#039;, &#039;&#039;fchmodat&#039;&#039;, &#039;&#039;fchownat&#039;&#039;, &#039;&#039;fstatat&#039;&#039;, &#039;&#039;linkat&#039;&#039;, &#039;&#039;unlinkat&#039;&#039;, &#039;&#039;renameat&#039;&#039; and &#039;&#039;fchmodat&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Device Management Calls==&lt;br /&gt;
&lt;br /&gt;
The device management system calls are linked to hardware and they are mainly used to requests for devices, release devices, to logically attach a device or to detach it, get and modified device attributes and read and write to them. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two of the most important system calls for the UNIX and Linux operating system is ‘‘mount’’ and ‘‘umount’’. These were among the few system calls available in UNIX in the 70s. The two calls allowed the operating system to load file systems on storage devices. A few changes were done to the mount system calls most of them were the creation of new mount flags to enhance performance. For example, since Linux 2.5.19, the MS_DIRSYNC flag permits the directory changes on a file system synchronous. Another Linux improvement was to provide per-process mount namespaces. This was added on the 2.4.19 kernel. If a process was created using clone() with the CLONE_NEWNS flag, the process will have a new namespace initialized to be a copy of the namespace of the process that was cloned. The ‘‘umount’’ system call unmounted the file system from the storage device. The only noteworthy change to ‘‘umount’’ was the creation of ‘‘umount2’’ in Linux 2.1.116. It is the same as ‘‘umount’’ except it allows different flags to control the operation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The ‘‘open’’, ‘‘read’’ and ‘‘write’’ calls can also be used to access devices. As discussed in the previous section, arguments flags are used to better control the device. You would use them as if the devices were files using the appropriate flags.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With the System V Unix revision 4(SVR4) came the system call ‘‘mmap’’. This system call is used to map or unmap files or devices into memory. Once a device is mapped, the system call returns a pointer to the mapped area allowing processes to access that device. This system call is still used in a Unix environment but since Linux 2.4, Linux replaced it by the mmap2 system call. It is basically the same as mmap except for a final argument specifying the offset into a file in 4096-byte units. This enables the mapping of large files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In version 7 of Unix, ‘‘ioctl’’ system call is used for device-specific operations that can’t be done using the standard system calls. This helps to deal with a multitude of devices. Each device drivers would provide a set of ioctl request code to allow various operations on their device. Each various request code are hardware dependent so there is no standard available for this system call.&lt;br /&gt;
&lt;br /&gt;
== Information Maintenance Calls==&lt;br /&gt;
Information maintenance calls are system calls that return the computers personal information back to the user or change it completely. These type of calls can be split up into three groups get/set time or date, get/set system data and get/set process,file, or device attributes. To fully understand the difference between Linux and UNIX in regrades to system call one must explore the three sub type of information maintenance calls and see how they have changed over time.&lt;br /&gt;
&lt;br /&gt;
The First sub type is Get/set of time and/or date, in Linux this can be done by a few different system call, there is: &#039;gettimeofday&#039; to get the time, &#039;settimeofday&#039; to set it, &#039;time&#039; returns the time in seconds. The earliest versions UNIX used the system call &#039;stime&#039; to interacted with time and dates. Stime could return the time and date and sets the system’s idea of the time and date by altering the seconds. &#039;stime&#039; is still being used by Linux because it is successful, unlike &#039;settimeofday&#039; which was created to change timezones (tz_dsttime) as well as the time but each occurrence of this field in the kernel source(apart for declaration) is a bug thus failing. (come back to) &lt;br /&gt;
&lt;br /&gt;
The second sub type is get/set system data. UNIX does this by....&lt;br /&gt;
&lt;br /&gt;
== Process Control Calls==&lt;br /&gt;
&lt;br /&gt;
== Communications Calls==&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous System Calls ==&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
Salus, Peter H. A Quarter Century of Unix, Publisher: Addison-Wesly Professional, June 10, 1994.&lt;br /&gt;
&lt;br /&gt;
Unix Programming Manual, http://cm.bell-labs.com/cm/cs/who/dmr/1stEdman.html, November 3, 1971.&lt;br /&gt;
&lt;br /&gt;
Linux Programmer&#039;s Manual, Linux man-pages project.&lt;br /&gt;
http://www.kernel.org/doc/man-pages/&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_1_2010_Question_2&amp;diff=3933</id>
		<title>COMP 3000 Essay 1 2010 Question 2</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_1_2010_Question_2&amp;diff=3933"/>
		<updated>2010-10-14T18:43:10Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Question=&lt;br /&gt;
How do the available system calls in modern versions of the Linux Kernel (2.6.30+) compare with the system calls available in the earliest versions of UNIX? How has the system call interface been expanded, and why? Focus on major changes or extensions in functionality.&lt;br /&gt;
&lt;br /&gt;
=Answer=&lt;br /&gt;
&lt;br /&gt;
A system call is a mean by which programs in the user space can access kernel services. Systems calls vary from operating system to operating system, although the underlying concepts tends to be the same. In general, a process is not supposed to be able to access the kernel directly. It can&#039;t access kernel memory and it can&#039;t call kernel functions. When the CPU prevents a process from accessing the kernel, this prevention is commonly known as, the protected mode. On the other hand, system calls are an exception to this rule. For example, older x86 processors used an interrupt mechanism to go from user-space to kernel-space, but newer processor (PentiumII+) provided instructions that optimize this transition using sysenter and sysexit instructions (Hayward, Mike. Intel P6 vs P7 system call performance. [http://lkml.org/lkml/2002/12/9/13], December 9, 2002).  All system calls are small programs built using the C programming language.&lt;br /&gt;
&lt;br /&gt;
The Unix and Linux systems calls are roughly grouped into 6 major categories: file management, device management, information maintenance, process control, communications and miscellaneous calls. The miscellaneous calls are all the ones that don’t really fit in the other categories, like system calls dealing with errors. Today, the Unix and Linux operating system contains hundreds of system calls but in general, they all came from the 35 system calls that came with one of the original UNIX OS in the early 70s. In the next paragraphs, we’re going to describe the various system calls in each of the categories mentioned above, their evolution through history (major changes in functionality) and a comparison with the earliest versions of UNIX.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== File Management Calls==&lt;br /&gt;
&lt;br /&gt;
The system calls in this group deal with every type of operation that is required to run a file system in the operating system. Create file, delete file, opening a file and closing a file are just a few examples of them and most of them hardly changed throughout the years. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;chmod&#039;&#039;, &#039;&#039;chown&#039;&#039; and &#039;&#039;chdir&#039;&#039; has been available since the earliest UNIX and it is still used in today’s Linux kernels. The &#039;&#039;chmod&#039;&#039; and &#039;&#039;chown&#039;&#039; calls allows the users to change the file attributes and implements security to the file system. The system call &#039;&#039;chdir&#039;&#039; allows the process to change the current working directory. In the 4th distribution of UNIX from Berkeley (4BSD), new system calls were added to be able to give more control on the file system to the applications. The call &#039;&#039;chroot&#039;&#039; allows the process to change the current root directory with one specified in a path argument. &#039;&#039;fchmod&#039;&#039; and &#039;&#039;fchdir&#039;&#039; are the same as &#039;&#039;chmod&#039;&#039; and &#039;&#039;chdir&#039;&#039; except it takes file descriptors as arguments. As of Linux kernel 2.1.81, the &#039;&#039;chown&#039;&#039; system call follows symbolic link and introduce a new system call, &#039;&#039;lchown&#039;&#039;, that does not follow symbolic links.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another four of the original UNIX system calls are &#039;&#039;open&#039;&#039;, &#039;&#039;creat&#039;&#039;, &#039;&#039;mkdir&#039;&#039; and &#039;&#039;close&#039;&#039;. The &#039;&#039;open&#039;&#039; and &#039;&#039;creat&#039;&#039; calls allows processes to open and possibly create a file or device. Arguments flags are used to set either access modes, like O_RDONLY(read-only), to status flags, like O_APPEND(append mode). The only modifications made to the system calls were the addition of status flags where some of them are only linux-specific. The &#039;&#039;close&#039;&#039; call allows processes to close a file descriptor preventing it to be reused. No changes were made to it. &#039;&#039;mkdir&#039;&#039; allows the creation of a file directory. At that point, to delete a directory, users would need to make a series of &#039;&#039;link&#039;&#039; and &#039;&#039;unlink&#039;&#039; system calls. With Unix 4.2BSD, &#039;&#039;rmdir&#039;&#039; and solved the problem. The &#039;&#039;rename&#039;&#039; call was also added in 4.2BSD allowing processes to change the name or the location of a file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is also system calls used to find, access and modify files. They are ’‘read’’, ‘‘write’’, ‘‘seek’’ and ‘‘stat’’. These were all part of earliest UNIX built. The ‘‘read’’ and ‘‘write’’ system calls allows to read and write from a file (assigned to a file descriptor). The only change was in SVR4 where a write can be interrupted at anytime. The ‘‘seek’’ system calls is used to go to a specified position in a file. This calls used a 16 bit address. But this was replaced very quickly for ‘‘lseek’’ as early as SVR4. It allows the call to use 32 bit addresses. It is still used in modern Linux and Unix systems even if developers are trying to implement ‘‘lseek64’’, a system call that will use 64 bit addresses. The ‘‘stat’’ system calls allows processes to get the status of a file. With SVR4, 2 other version of that system call were created: ‘‘fstat’’ and ‘‘lstat’’. They both do the same thing except ‘‘lstat’’ give the status of symbolic links and ‘‘fstat’’ give the status of a file specified by a file descriptor. Different operating systems will output different values to represent the state of a file. Since kernel 2.5.48, the stat returned a nanoseconds field in the file’s timestamp. With the release of 4.4BSD, two new system calls called ‘‘statvfs’’ and ‘‘fstatvfs’’ were introduced to provide information about a mounted file system. They both do the same thing except fstatvfs takes file descriptors as an argument. These calls are only used in an UNIX environment. In Linux, it has ‘‘statfs’’ and ‘‘fstatfs’’ to support that same call.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last two original UNIX system calls in this category that are still used today are &#039;&#039;link&#039;&#039; and &#039;&#039;unlink&#039;&#039;. &#039;&#039;link&#039;&#039; creates a hard link to an existing file and &#039;&#039;unlink&#039;&#039; deletes a file link’s name and possibly the file it refers to. If the name refers to a symbolic link, only the link is removed. No major changes were done to the &#039;&#039;unlink&#039;&#039; system calls but new system calls were create from &#039;&#039;link&#039;&#039;. The &#039;&#039;symlink&#039;&#039; system call was added in 4.2BSD to allow the creation of symbolic links in the file system. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the Linux 2.6.16 build, multiple system calls were created so that the calls could deal with relative pathnames as arguments. They can easily be spotted as the system call names all finish with &#039;at&#039;. Here is a sample list of the created system calls: &#039;&#039;openat&#039;&#039;, &#039;&#039;mkdirat&#039;&#039;, &#039;&#039;fchmodat&#039;&#039;, &#039;&#039;fchownat&#039;&#039;, &#039;&#039;fstatat&#039;&#039;, &#039;&#039;linkat&#039;&#039;, &#039;&#039;unlinkat&#039;&#039;, &#039;&#039;renameat&#039;&#039; and &#039;&#039;fchmodat&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Device Management Calls==&lt;br /&gt;
&lt;br /&gt;
The device management system calls are linked to hardware and they are mainly used to requests for devices, release devices, to logically attach a device or to detach it, get and modified device attributes and read and write to them. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two of the most important system calls for the UNIX and Linux operating system is ‘‘mount’’ and ‘‘umount’’. These were among the few system calls available in UNIX in the 70s. The two calls allowed the operating system to load file systems on storage devices. A few changes were done to the mount system calls most of them were the creation of new mount flags to enhance performance. For example, since Linux 2.5.19, the MS_DIRSYNC flag permits the directory changes on a file system synchronous. Another Linux improvement was to provide per-process mount namespaces. This was added on the 2.4.19 kernel. If a process was created using clone() with the CLONE_NEWNS flag, the process will have a new namespace initialized to be a copy of the namespace of the process that was cloned. The ‘‘umount’’ system call unmounted the file system from the storage device. The only noteworthy change to ‘‘umount’’ was the creation of ‘‘umount2’’ in Linux 2.1.116. It is the same as ‘‘umount’’ except it allows different flags to control the operation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The ‘‘open’’, ‘‘read’’ and ‘‘write’’ calls can also be used to access devices. As discussed in the previous section, arguments flags are used to better control the device. You would use them as if the devices were files using the appropriate flags.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With the System V Unix revision 4(SVR4) came the system call ‘‘mmap’’. This system call is used to map or unmap files or devices into memory. Once a device is mapped, the system call returns a pointer to the mapped area allowing processes to access that device. This system call is still used in a Unix environment but since Linux 2.4, Linux replaced it by the mmap2 system call. It is basically the same as mmap except for a final argument specifying the offset into a file in 4096-byte units. This enables the mapping of large files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In version 7 of Unix, ‘‘ioctl’’ system call is used for device-specific operations that can’t be done using the standard system calls. This helps to deal with a multitude of devices. Each device drivers would provide a set of ioctl request code to allow various operations on their device. Each various request code are hardware dependent so there is no standard available for this system call.&lt;br /&gt;
&lt;br /&gt;
== Information Maintenance Calls==&lt;br /&gt;
Information maintenance calls are system calls that return the computers personal information back to the user or change it completely. These type of calls can be split up into three groups get/set time or date, get/set system data and get/set process,file, or device attributes. To fully understand the difference between Linux and UNIX in regrades to system call one must explore the three sub type of information maintenance calls and see how they have changed over time.&lt;br /&gt;
&lt;br /&gt;
The First sub type is Get/set of time and/or date, in Linux this can be done by a few different system call, there is: &#039;gettimeofday&#039; to get the time, &#039;settimeofday&#039; to set it, &#039;time&#039; returns the time in seconds. The earliest versions UNIX used the system call &#039;stime&#039; to interacted with time and dates. Stime could return the time and date and sets the system’s idea of the time and date by altering the seconds. &#039;stime&#039; is still being used by Linux because it is successful, unlike &#039;settimeofday&#039; which was created to change timezones (tz_dsttime) as well as the time but each occurrence of this field in the kernel source(apart for declaration) is a bug thus failing. (come back to) &lt;br /&gt;
&lt;br /&gt;
The second sub type is get/set system data. UNIX does this by....&lt;br /&gt;
&lt;br /&gt;
== Process Control Calls==&lt;br /&gt;
&lt;br /&gt;
== Communications Calls==&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous System Calls ==&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
Salus, Peter H. A Quarter Century of Unix, Publisher: Addison-Wesly Professional, June 10, 1994.&lt;br /&gt;
&lt;br /&gt;
Unix Programming Manual, http://cm.bell-labs.com/cm/cs/who/dmr/1stEdman.html, November 3, 1971.&lt;br /&gt;
&lt;br /&gt;
Linux Programmer&#039;s Manual, Linux man-pages project.&lt;br /&gt;
http://www.kernel.org/doc/man-pages/&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_1_2010_Question_2&amp;diff=3927</id>
		<title>COMP 3000 Essay 1 2010 Question 2</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_1_2010_Question_2&amp;diff=3927"/>
		<updated>2010-10-14T18:37:34Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: /* File Management Calls */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Question=&lt;br /&gt;
How do the available system calls in modern versions of the Linux Kernel (2.6.30+) compare with the system calls available in the earliest versions of UNIX? How has the system call interface been expanded, and why? Focus on major changes or extensions in functionality.&lt;br /&gt;
&lt;br /&gt;
=Answer=&lt;br /&gt;
&lt;br /&gt;
A system call is a mean by which programs in the user space can access kernel services. Systems calls vary from operating system to operating system, although the underlying concepts tends to be the same. In general, a process is not supposed to be able to access the kernel directly. It can&#039;t access kernel memory and it can&#039;t call kernel functions. When the CPU prevents a process from accessing the kernel, this prevention is commonly known as, the protected mode. On the other hand, system calls are an exception to this rule. For example, older x86 processors used an interrupt mechanism to go from user-space to kernel-space, but newer processor (PentiumII+) provided instructions that optimize this transition using sysenter and sysexit instructions (Hayward, Mike. Intel P6 vs P7 system call performance. [http://lkml.org/lkml/2002/12/9/13], December 9, 2002).  All system calls are small programs built using the C programming language.&lt;br /&gt;
&lt;br /&gt;
The Unix and Linux systems calls are roughly grouped into 6 major categories: file management, device management, information maintenance, process control, communications and miscellaneous calls. The miscellaneous calls are all the ones that don’t really fit in the other categories, like system calls dealing with errors. Today, the Unix and Linux operating system contains hundreds of system calls but in general, they all came from the 35 system calls that came with one of the original UNIX OS in the early 70s. In the next paragraphs, we’re going to describe the various system calls in each of the categories mentioned above, their evolution through history (major changes in functionality) and a comparison with the earliest versions of UNIX.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== File Management Calls==&lt;br /&gt;
&lt;br /&gt;
The system calls in this group deal with every type of operation that is required to run a file system in the operating system. Create file, delete file, opening a file and closing a file are just a few examples of them and most of them hardly changed throughout the years. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;chmod&#039;&#039;, &#039;&#039;chown&#039;&#039; and &#039;&#039;chdir&#039;&#039; has been available since the earliest UNIX and it is still used in today’s Linux kernels. The &#039;&#039;chmod&#039;&#039; and &#039;&#039;chown&#039;&#039; calls allows the users to change the file attributes and implements security to the file system. The system call &#039;&#039;chdir&#039;&#039; allows the process to change the current working directory. In the 4th distribution of UNIX from Berkeley (4BSD), new system calls were added to be able to give more control on the file system to the applications. The call &#039;&#039;chroot&#039;&#039; allows the process to change the current root directory with one specified in a path argument. &#039;&#039;fchmod&#039;&#039; and &#039;&#039;fchdir&#039;&#039; are the same as &#039;&#039;chmod&#039;&#039; and &#039;&#039;chdir&#039;&#039; except it takes file descriptors as arguments. As of Linux kernel 2.1.81, the &#039;&#039;chown&#039;&#039; system call follows symbolic link and introduce a new system call, &#039;&#039;lchown&#039;&#039;, that does not follow symbolic links.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another four of the original UNIX system calls are &#039;&#039;open&#039;&#039;, &#039;&#039;creat&#039;&#039;, &#039;&#039;mkdir&#039;&#039; and &#039;&#039;close&#039;&#039;. The &#039;&#039;open&#039;&#039; and &#039;&#039;creat&#039;&#039; calls allows processes to open and possibly create a file or device. Arguments flags are used to set either access modes, like O_RDONLY(read-only), to status flags, like O_APPEND(append mode). The only modifications made to the system calls were the addition of status flags where some of them are only linux-specific. The &#039;&#039;close&#039;&#039; call allows processes to close a file descriptor preventing it to be reused. No changes were made to it. &#039;&#039;mkdir&#039;&#039; allows the creation of a file directory. At that point, to delete a directory, users would need to make a series of &#039;&#039;link&#039;&#039; and &#039;&#039;unlink&#039;&#039; system calls. With Unix 4.2BSD, &#039;&#039;rmdir&#039;&#039; and solved the problem. The &#039;&#039;rename&#039;&#039; call was also added in 4.2BSD allowing processes to change the name or the location of a file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is also system calls used to find, access and modify files. They are ’‘read’’, ‘‘write’’, ‘‘seek’’ and ‘‘stat’’. These were all part of earliest UNIX built. The ‘‘read’’ and ‘‘write’’ system calls allows to read and write from a file (assigned to a file descriptor). The only change was in SVR4 where a write can be interrupted at anytime. The ‘‘seek’’ system calls is used to go to a specified position in a file. This calls used a 16 bit address. But this was replaced very quickly for ‘‘lseek’’ as early as SVR4. It allows the call to use 32 bit addresses. It is still used in modern Linux and Unix systems even if developers are trying to implement ‘‘lseek64’’, a system call that will use 64 bit addresses. The ‘‘stat’’ system calls allows processes to get the status of a file. With SVR4, 2 other version of that system call were created: ‘‘fstat’’ and ‘‘lstat’’. They both do the same thing except ‘‘lstat’’ give the status of symbolic links and ‘‘fstat’’ give the status of a file specified by a file descriptor. Different operating systems will output different values to represent the state of a file. Since kernel 2.5.48, the stat returned a nanoseconds field in the file’s timestamp. With the release of 4.4BSD, two new system calls called ‘‘statvfs’’ and ‘‘fstatvfs’’ were introduced to provide information about a mounted file system. They both do the same thing except fstatvfs takes file descriptors as an argument. These calls are only used in an UNIX environment. In Linux, it has ‘‘statfs’’ and ‘‘fstatfs’’ to support that same call.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last two original UNIX system calls in this category that are still used today are &#039;&#039;link&#039;&#039; and &#039;&#039;unlink&#039;&#039;. &#039;&#039;link&#039;&#039; creates a hard link to an existing file and &#039;&#039;unlink&#039;&#039; deletes a file link’s name and possibly the file it refers to. If the name refers to a symbolic link, only the link is removed. No major changes were done to the &#039;&#039;unlink&#039;&#039; system calls but new system calls were create from &#039;&#039;link&#039;&#039;. The &#039;&#039;symlink&#039;&#039; system call was added in 4.2BSD to allow the creation of symbolic links in the file system. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the Linux 2.6.16 build, multiple system calls were created so that the calls could deal with relative pathnames as arguments. They can easily be spotted as the system call names all finish with &#039;at&#039;. Here is a sample list of the created system calls: &#039;&#039;openat&#039;&#039;, &#039;&#039;mkdirat&#039;&#039;, &#039;&#039;fchmodat&#039;&#039;, &#039;&#039;fchownat&#039;&#039;, &#039;&#039;fstatat&#039;&#039;, &#039;&#039;linkat&#039;&#039;, &#039;&#039;unlinkat&#039;&#039;, &#039;&#039;renameat&#039;&#039; and &#039;&#039;fchmodat&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Device Management Calls==&lt;br /&gt;
&lt;br /&gt;
The device management system calls are linked to hardware and they are mainly used to requests for devices, release devices, to logically attach a device or to detach it, get and modified device attributes and read and write to them. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two of the most important system calls for the UNIX and Linux operating system is ‘‘mount’’ and ‘‘umount’’. These were among the few system calls available in UNIX in the 70s. The two calls allowed the operating system to load file systems on storage devices. A few changes were done to the mount system calls most of them were the creation of new mount flags to enhance performance. For example, since Linux 2.5.19, the MS_DIRSYNC flag permits the directory changes on a file system synchronous. Another Linux improvement was to provide per-process mount namespaces. This was added on the 2.4.19 kernel. If a process was created using clone() with the CLONE_NEWNS flag, the process will have a new namespace initialized to be a copy of the namespace of the process that was cloned. The ‘‘umount’’ system call unmounted the file system from the storage device. The only noteworthy change to ‘‘umount’’ was the creation of ‘‘umount2’’ in Linux 2.1.116. It is the same as ‘‘umount’’ except it allows different flags to control the operation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The ‘‘open’’, ‘‘read’’ and ‘‘write’’ calls can also be used to access devices. As discussed in the previous section, arguments flags are used to better control the device. You would use them as if the devices were files using the appropriate flags.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With the System V Unix revision 4(SVR4) came the system call ‘‘mmap’’. This system call is used to map or unmap files or devices into memory. Once a device is mapped, the system call returns a pointer to the mapped area allowing processes to access that device. This system call is still used in a Unix environment but since Linux 2.4, Linux replaced it by the mmap2 system call. It is basically the same as mmap except for a final argument specifying the offset into a file in 4096-byte units. This enables the mapping of large files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In version 7 of Unix, ‘‘ioctl’’ system call is used for device-specific operations that can’t be done using the standard system calls. This helps to deal with a multitude of devices. Each device drivers would provide a set of ioctl request code to allow various operations on their device. Each various request code are hardware dependent so there is no standard available for this system call.&lt;br /&gt;
&lt;br /&gt;
== Information Maintenance Calls==&lt;br /&gt;
Information maintenance calls are system calls that return the computers personal information back to the user or change it completely. These type of calls can be split up into three groups get/set time or date, get/set system data and get/set process,file, or device attributes. To fully understand the difference between Linux and UNIX in regrades to system call one must explore the three sub type of information maintenance calls and see how they have changed over time.&lt;br /&gt;
&lt;br /&gt;
The First sub type is Get/set of time and/or date, in Linux this can be done by a few different system call, there is: &#039;gettimeofday&#039; to get the time, &#039;settimeofday&#039; to set it, &#039;time&#039; returns the time in seconds. The earliest versions UNIX used the system call &#039;stime&#039; to interacted with time and dates. Stime could return the time and date and sets the system’s idea of the time and date by altering the seconds. &#039;stime&#039; is still being used by Linux because it is successful, unlike &#039;settimeofday&#039; which was created to change timezones (tz_dsttime) as well as the time but each occurrence of this field in the kernel source(apart for declaration) is a bug thus failing. (come back to) &lt;br /&gt;
&lt;br /&gt;
The second sub type is get/set system data. UNIX does this by....&lt;br /&gt;
&lt;br /&gt;
== Process Control Calls==&lt;br /&gt;
&lt;br /&gt;
== Communications Calls==&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous System Calls ==&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
Unix Programming Manual, http://cm.bell-labs.com/cm/cs/who/dmr/1stEdman.html, November 3, 1971.&lt;br /&gt;
&lt;br /&gt;
Linux Programmer&#039;s Manual, Linux man-pages project.&lt;br /&gt;
http://www.kernel.org/doc/man-pages/&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_1_2010_Question_2&amp;diff=3922</id>
		<title>COMP 3000 Essay 1 2010 Question 2</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_1_2010_Question_2&amp;diff=3922"/>
		<updated>2010-10-14T18:30:55Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Question=&lt;br /&gt;
How do the available system calls in modern versions of the Linux Kernel (2.6.30+) compare with the system calls available in the earliest versions of UNIX? How has the system call interface been expanded, and why? Focus on major changes or extensions in functionality.&lt;br /&gt;
&lt;br /&gt;
=Answer=&lt;br /&gt;
&lt;br /&gt;
A system call is a mean by which programs in the user space can access kernel services. Systems calls vary from operating system to operating system, although the underlying concepts tends to be the same. In general, a process is not supposed to be able to access the kernel directly. It can&#039;t access kernel memory and it can&#039;t call kernel functions. When the CPU prevents a process from accessing the kernel, this prevention is commonly known as, the protected mode. On the other hand, system calls are an exception to this rule. For example, older x86 processors used an interrupt mechanism to go from user-space to kernel-space, but newer processor (PentiumII+) provided instructions that optimize this transition using sysenter and sysexit instructions (Hayward, Mike. Intel P6 vs P7 system call performance. [http://lkml.org/lkml/2002/12/9/13], December 9, 2002).  All system calls are small programs built using the C programming language.&lt;br /&gt;
&lt;br /&gt;
The Unix and Linux systems calls are roughly grouped into 6 major categories: file management, device management, information maintenance, process control, communications and miscellaneous calls. The miscellaneous calls are all the ones that don’t really fit in the other categories, like system calls dealing with errors. Today, the Unix and Linux operating system contains hundreds of system calls but in general, they all came from the 35 system calls that came with one of the original UNIX OS in the early 70s. In the next paragraphs, we’re going to describe the various system calls in each of the categories mentioned above, their evolution through history (major changes in functionality) and a comparison with the earliest versions of UNIX.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== File Management Calls==&lt;br /&gt;
&lt;br /&gt;
The system calls in this group deal with every type of operation that is required to run a file system in the operating system. Create file, delete file, opening a file and closing a file are just a few examples of them and most of them hardly changed throughout the years. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;chmod&#039;&#039;, &#039;&#039;chown&#039;&#039; and &#039;&#039;chdir&#039;&#039; has been available since the earliest UNIX and it is still used in today’s Linux kernels. The &#039;&#039;chmod&#039;&#039; and &#039;&#039;chown&#039;&#039; calls allows the users to change the file attributes and implements security to the file system. The system call &#039;&#039;chdir&#039;&#039; allows the process to change the current working directory. In the 4th distribution of UNIX from Berkeley (4BSD), new system calls were added to be able to give more control on the file system to the applications. The call &#039;&#039;chroot&#039;&#039; allows the process to change the current root directory with one specified in a path argument. &#039;&#039;fchmod&#039;&#039; and &#039;&#039;fchdir&#039;&#039; are the same as &#039;&#039;chmod&#039;&#039; and &#039;&#039;chdir&#039;&#039; except it takes file descriptors as arguments. As of Linux kernel 2.1.81, the &#039;&#039;chown&#039;&#039; system call follows symbolic link and introduce a new system call, &#039;&#039;lchown&#039;&#039;, that does not follow symbolic links. As of Linux 2.6.16, &#039;&#039;fchownat&#039;&#039; and &#039;&#039;fchmodat&#039;&#039; was added. It operates the same way as &#039;&#039;chown&#039;&#039; and &#039;&#039;chmod&#039;&#039; but takes more arguments to deal with relative pathnames. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another four of the original UNIX system calls are &#039;&#039;open&#039;&#039;, &#039;&#039;creat&#039;&#039;, &#039;&#039;mkdir&#039;&#039; and &#039;&#039;close&#039;&#039;. The &#039;&#039;open&#039;&#039; and &#039;&#039;creat&#039;&#039; calls allows processes to open and possibly create a file or device. Arguments flags are used to set either access modes, like O_RDONLY(read-only), to status flags, like O_APPEND(append mode). The only modifications made to the system calls were the addition of status flags where some of them are only linux-specific. The &#039;&#039;close&#039;&#039; call allows processes to close a file descriptor preventing it to be reused. No changes were made to it. &#039;&#039;mkdir&#039;&#039; allows the creation of a file directory. At that point, to delete a directory, users would need to make a series of &#039;&#039;link&#039;&#039; and &#039;&#039;unlink&#039;&#039; system calls. With Unix 4.2BSD, &#039;&#039;rmdir&#039;&#039; and solved the problem. The &#039;&#039;rename&#039;&#039; call was also added in 4.2BSD allowing processes to change the name or the location of a file.As of Linux 2.6.16, &#039;&#039;openat&#039;&#039;, &#039;&#039;mkdirat&#039;&#039; and &#039;&#039;renameat&#039;&#039; was added. It for the same reasons as &#039;&#039;fchmodat&#039;&#039; and &#039;&#039;fchmownat&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is also system calls used to find, access and modify files. They are ’‘read’’, ‘‘write’’, ‘‘seek’’ and ‘‘stat’’. These were all part of earliest UNIX built. The ‘‘read’’ and ‘‘write’’ system calls allows to read and write from a file (assigned to a file descriptor). The only change was in SVR4 where a write can be interrupted at anytime. The ‘‘seek’’ system calls is used to go to a specified position in a file. This calls used a 16 bit address. But this was replaced very quickly for ‘‘lseek’’ as early as SVR4. It allows the call to use 32 bit addresses. It is still used in modern Linux and Unix systems even if developers are trying to implement ‘‘lseek64’’, a system call that will use 64 bit addresses. The ‘‘stat’’ system calls allows processes to get the status of a file. With SVR4, 2 other version of that system call were created: ‘‘fstat’’ and ‘‘lstat’’. They both do the same thing except ‘‘lstat’’ give the status of symbolic links and ‘‘fstat’’ give the status of a file specified by a file descriptor. Different operating systems will output different values to represent the state of a file. Since kernel 2.5.48, the stat returned a nanoseconds field in the file’s timestamp. The ‘‘fstatat’’ system call was added to Linux kernel 2.6.16. This is again for the same reason as ‘‘openat’’. With the release of 4.4BSD, two new system calls called ‘‘statvfs’’ and ‘‘fstatvfs’’ were introduced to provide information about a mounted file system. They both do the same thing except fstatvfs takes file descriptors as an argument. These calls are only used in an UNIX environment. In Linux, it has ‘‘statfs’’ and ‘‘fstatfs’’ to support that same call.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last two original UNIX system calls in this category that are still used today are &#039;&#039;link&#039;&#039; and &#039;&#039;unlink&#039;&#039;. &#039;&#039;link&#039;&#039; creates a hard link to an existing file and &#039;&#039;unlink&#039;&#039; deletes a file link’s name and possibly the file it refers to. If the name refers to a symbolic link, only the link is removed. No major changes were done to the &#039;&#039;unlink&#039;&#039; system calls but new system calls were create from &#039;&#039;link&#039;&#039;. The &#039;&#039;symlink&#039;&#039; system call was added in 4.2BSD to allow the creation of symbolic links in the file system. Again in Linux 2.6.16, &#039;&#039;linkat&#039;&#039; and &#039;&#039;unlinkat&#039;&#039; were added for the same reasons as &#039;&#039;openat&#039;&#039;, &#039;&#039;fchmadat&#039;&#039; and &#039;&#039;fchownat&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Device Management Calls==&lt;br /&gt;
&lt;br /&gt;
The device management system calls are linked to hardware and they are mainly used to requests for devices, release devices, to logically attach a device or to detach it, get and modified device attributes and read and write to them. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two of the most important system calls for the UNIX and Linux operating system is ‘‘mount’’ and ‘‘umount’’. These were among the few system calls available in UNIX in the 70s. The two calls allowed the operating system to load file systems on storage devices. A few changes were done to the mount system calls most of them were the creation of new mount flags to enhance performance. For example, since Linux 2.5.19, the MS_DIRSYNC flag permits the directory changes on a file system synchronous. Another Linux improvement was to provide per-process mount namespaces. This was added on the 2.4.19 kernel. If a process was created using clone() with the CLONE_NEWNS flag, the process will have a new namespace initialized to be a copy of the namespace of the process that was cloned. The ‘‘umount’’ system call unmounted the file system from the storage device. The only noteworthy change to ‘‘umount’’ was the creation of ‘‘umount2’’ in Linux 2.1.116. It is the same as ‘‘umount’’ except it allows different flags to control the operation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The ‘‘open’’, ‘‘read’’ and ‘‘write’’ calls can also be used to access devices. As discussed in the previous section, arguments flags are used to better control the device. You would use them as if the devices were files using the appropriate flags.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With the System V Unix revision 4(SVR4) came the system call ‘‘mmap’’. This system call is used to map or unmap files or devices into memory. Once a device is mapped, the system call returns a pointer to the mapped area allowing processes to access that device. This system call is still used in a Unix environment but since Linux 2.4, Linux replaced it by the mmap2 system call. It is basically the same as mmap except for a final argument specifying the offset into a file in 4096-byte units. This enables the mapping of large files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In version 7 of Unix, ‘‘ioctl’’ system call is used for device-specific operations that can’t be done using the standard system calls. This helps to deal with a multitude of devices. Each device drivers would provide a set of ioctl request code to allow various operations on their device. Each various request code are hardware dependent so there is no standard available for this system call.&lt;br /&gt;
&lt;br /&gt;
== Information Maintenance Calls==&lt;br /&gt;
Information maintenance calls are system calls that return the computers personal information back to the user or change it completely. These type of calls can be split up into three groups get/set time or date, get/set system data and get/set process,file, or device attributes. To fully understand the difference between Linux and UNIX in regrades to system call one must explore the three sub type of information maintenance calls and see how they have changed over time.&lt;br /&gt;
&lt;br /&gt;
The First sub type is Get/set of time and/or date, in Linux this can be done by a few different system call, there is: &#039;gettimeofday&#039; to get the time, &#039;settimeofday&#039; to set it, &#039;time&#039; returns the time in seconds. The earliest versions UNIX used the system call &#039;stime&#039; to interacted with time and dates. Stime could return the time and date and sets the system’s idea of the time and date by altering the seconds. &#039;stime&#039; is still being used by Linux because it is successful, unlike &#039;settimeofday&#039; which was created to change timezones (tz_dsttime) as well as the time but each occurrence of this field in the kernel source(apart for declaration) is a bug thus failing. (come back to) &lt;br /&gt;
&lt;br /&gt;
The second sub type is get/set system data. UNIX does this by....&lt;br /&gt;
&lt;br /&gt;
== Process Control Calls==&lt;br /&gt;
&lt;br /&gt;
== Communications Calls==&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous System Calls ==&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
Unix Programming Manual, http://cm.bell-labs.com/cm/cs/who/dmr/1stEdman.html, November 3, 1971.&lt;br /&gt;
&lt;br /&gt;
Linux Programmer&#039;s Manual, Linux man-pages project.&lt;br /&gt;
http://www.kernel.org/doc/man-pages/&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_1_2010_Question_2&amp;diff=3920</id>
		<title>COMP 3000 Essay 1 2010 Question 2</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_1_2010_Question_2&amp;diff=3920"/>
		<updated>2010-10-14T18:30:21Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Question=&lt;br /&gt;
How do the available system calls in modern versions of the Linux Kernel (2.6.30+) compare with the system calls available in the earliest versions of UNIX? How has the system call interface been expanded, and why? Focus on major changes or extensions in functionality.&lt;br /&gt;
&lt;br /&gt;
=Answer=&lt;br /&gt;
&lt;br /&gt;
A system call is a mean by which programs in the user space can access kernel services. Systems calls vary from operating system to operating system, although the underlying concepts tends to be the same. In general, a process is not supposed to be able to access the kernel directly. It can&#039;t access kernel memory and it can&#039;t call kernel functions. When the CPU prevents a process from accessing the kernel, this prevention is commonly known as, the protected mode. On the other hand, system calls are an exception to this rule. For example, older x86 processors used an interrupt mechanism to go from user-space to kernel-space, but newer processor (PentiumII+) provided instructions that optimize this transition using sysenter and sysexit instructions (Hayward, Mike. Intel P6 vs P7 system call performance. [http://lkml.org/lkml/2002/12/9/13], December 9, 2002).  All system calls are small programs built using the C programming language.&lt;br /&gt;
&lt;br /&gt;
The Unix and Linux systems calls are roughly grouped into 6 major categories: file management, device management, information maintenance, process control, communications and miscellaneous calls. The miscellaneous calls are all the ones that don’t really fit in the other categories, like system calls dealing with errors. Today, the Unix and Linux operating system contains hundreds of system calls but in general, they all came from the 35 system calls that came with one of the original UNIX OS in the early 70s. In the next paragraphs, we’re going to describe the various system calls in each of the categories mentioned above, their evolution through history (major changes in functionality) and a comparison with the earliest versions of UNIX.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== File Management Calls==&lt;br /&gt;
&lt;br /&gt;
The system calls in this group deal with every type of operation that is required to run a file system in the operating system. Create file, delete file, opening a file and closing a file are just a few examples of them and most of them hardly changed throughout the years. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;chmod&#039;&#039;, &#039;&#039;chown&#039;&#039; and &#039;&#039;chdir&#039;&#039; has been available since the earliest UNIX and it is still used in today’s Linux kernels. The &#039;&#039;chmod&#039;&#039; and &#039;&#039;chown&#039;&#039; calls allows the users to change the file attributes and implements security to the file system. The system call &#039;&#039;chdir&#039;&#039; allows the process to change the current working directory. In the 4th distribution of UNIX from Berkeley (4BSD), new system calls were added to be able to give more control on the file system to the applications. The call &#039;&#039;chroot&#039;&#039; allows the process to change the current root directory with one specified in a path argument. &#039;&#039;fchmod&#039;&#039; and &#039;&#039;fchdir&#039;&#039; are the same as &#039;&#039;chmod&#039;&#039; and &#039;&#039;chdir&#039;&#039; except it takes file descriptors as arguments. As of Linux kernel 2.1.81, the &#039;&#039;chown&#039;&#039; system call follows symbolic link and introduce a new system call, &#039;&#039;lchown&#039;&#039;, that does not follow symbolic links. As of Linux 2.6.16, &#039;&#039;fchownat&#039;&#039; and &#039;&#039;fchmodat&#039;&#039; was added. It operates the same way as &#039;&#039;chown&#039;&#039; and &#039;&#039;chmod&#039;&#039; but takes more arguments to deal with relative pathnames. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another four of the original UNIX system calls are &#039;&#039;open&#039;&#039;, &#039;&#039;creat&#039;&#039;, &#039;&#039;mkdir&#039;&#039; and &#039;&#039;close&#039;&#039;. The &#039;&#039;open&#039;&#039; and &#039;&#039;creat&#039;&#039; calls allows processes to open and possibly create a file or device. Arguments flags are used to set either access modes, like O_RDONLY(read-only), to status flags, like O_APPEND(append mode). The only modifications made to the system calls were the addition of status flags where some of them are only linux-specific. The &#039;&#039;close&#039;&#039; call allows processes to close a file descriptor preventing it to be reused. No changes were made to it. &#039;&#039;mkdir&#039;&#039; allows the creation of a file directory. At that point, to delete a directory, users would need to make a series of &#039;&#039;link&#039;&#039; and &#039;&#039;unlink&#039;&#039; system calls. With Unix 4.2BSD, &#039;&#039;rmdir&#039;&#039; and solved the problem. The &#039;&#039;rename&#039;&#039; call was also added in 4.2BSD allowing processes to change the name or the location of a file.As of Linux 2.6.16, &#039;&#039;openat&#039;&#039;, &#039;&#039;mkdirat&#039;&#039; and &#039;&#039;renameat&#039;&#039; was added. It for the same reasons as &#039;&#039;fchmodat&#039;&#039; and &#039;&#039;fchmownat&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is also system calls used to find, access and modify files. They are ’‘read’’, ‘‘write’’, ‘‘seek’’ and ‘‘stat’’. These were all part of earliest UNIX built. The ‘‘read’’ and ‘‘write’’ system calls allows to read and write from a file (assigned to a file descriptor). The only change was in SVR4 where a write can be interrupted at anytime. The ‘‘seek’’ system calls is used to go to a specified position in a file. This calls used a 16 bit address. But this was replaced very quickly for ‘‘lseek’’ as early as SVR4. It allows the call to use 32 bit addresses. It is still used in modern Linux and Unix systems even if developers are trying to implement ‘‘lseek64’’, a system call that will use 64 bit addresses. The ‘‘stat’’ system calls allows processes to get the status of a file. With SVR4, 2 other version of that system call were created: ‘‘fstat’’ and ‘‘lstat’’. They both do the same thing except ‘‘lstat’’ give the status of symbolic links and ‘‘fstat’’ give the status of a file specified by a file descriptor. Different operating systems will output different values to represent the state of a file. Since kernel 2.5.48, the stat returned a nanoseconds field in the file’s timestamp. The ‘‘fstatat’’ system call was added to Linux kernel 2.6.16. This is again for the same reason as ‘‘openat’’. With the release of 4.4BSD, two new system calls called ‘‘statvfs’’ and ‘‘fstatvfs’’ were introduced to provide information about a mounted file system. They both do the same thing except fstatvfs takes file descriptors as an argument. These calls are only used in an UNIX environment. In Linux, it has ‘‘statfs’’ and ‘‘fstatfs’’ to support that same call.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last two original UNIX system calls in this category that are still used today are &#039;&#039;link&#039;&#039; and &#039;&#039;unlink&#039;&#039;. &#039;&#039;link&#039;&#039; creates a hard link to an existing file and &#039;&#039;unlink&#039;&#039; deletes a file link’s name and possibly the file it refers to. If the name refers to a symbolic link, only the link is removed. No major changes were done to the &#039;&#039;unlink&#039;&#039; system calls but new system calls were create from &#039;&#039;link&#039;&#039;. The &#039;&#039;symlink&#039;&#039; system call was added in 4.2BSD to allow the creation of symbolic links in the file system. Again in Linux 2.6.16, &#039;&#039;linkat&#039;&#039; and &#039;&#039;unlinkat&#039;&#039; were added for the same reasons as &#039;&#039;openat&#039;&#039;, &#039;&#039;fchmadat&#039;&#039; and &#039;&#039;fchownat&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Device Management Calls==&lt;br /&gt;
&lt;br /&gt;
The device management system calls are linked to hardware and they are mainly used to requests for devices, release devices, to logically attach a device or to detach it, get and modified device attributes and read and write to them. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two of the most important system calls for the UNIX and Linux operating system is ‘‘mount’’ and ‘‘umount’’. These were among the few system calls available in UNIX in the 70s. The two calls allowed the operating system to load file systems on storage devices. A few changes were done to the mount system calls most of them were the creation of new mount flags to enhance performance. For example, since Linux 2.5.19, the MS_DIRSYNC flag permits the directory changes on a file system synchronous. Another Linux improvement was to provide per-process mount namespaces. This was added on the 2.4.19 kernel. If a process was created using clone() with the CLONE_NEWNS flag, the process will have a new namespace initialized to be a copy of the namespace of the process that was cloned. The ‘‘umount’’ system call unmounted the file system from the storage device. The only noteworthy change to ‘‘umount’’ was the creation of ‘‘umount2’’ in Linux 2.1.116. It is the same as ‘‘umount’’ except it allows different flags to control the operation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The ‘‘open’’, ‘‘read’’ and ‘‘write’’ calls can also be used to access devices. As discussed in the previous section, arguments flags are used to better control the device. You would use them as if the devices were files using the appropriate flags.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With the System V Unix revision 4(SVR4) came the system call ‘‘mmap’’. This system call is used to map or unmap files or devices into memory. Once a device is mapped, the system call returns a pointer to the mapped area allowing processes to access that device. This system call is still used in a Unix environment but since Linux 2.4, Linux replaced it by the mmap2 system call. It is basically the same as mmap except for a final argument specifying the offset into a file in 4096-byte units. This enables the mapping of large files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In version 7 of Unix, ‘‘ioctl’’ system call is used for device-specific operations that can’t be done using the standard system calls. This helps to deal with a multitude of devices. Each device drivers would provide a set of ioctl request code to allow various operations on their device. Each various request code are hardware dependent so there is no standard available for this system call.&lt;br /&gt;
&lt;br /&gt;
== Information Maintenance Calls==&lt;br /&gt;
Information maintenance calls are system calls that return the computers personal information back to the user or change it completely. These type of calls can be split up into three groups get/set time or date, get/set system data and get/set process,file, or device attributes. To fully understand the difference between Linux and UNIX in regrades to system call one must explore the three sub type of information maintenance calls and see how they have changed over time.&lt;br /&gt;
&lt;br /&gt;
The First sub type is Get/set of time and/or date, in Linux this can be done by a few different system call, there is: &#039;gettimeofday&#039; to get the time, &#039;settimeofday&#039; to set it, &#039;time&#039; returns the time in seconds. The earliest versions UNIX used the system call &#039;stime&#039; to interacted with time and dates. Stime could return the time and date and sets the system’s idea of the time and date by altering the seconds. &#039;stime&#039; is still being used by Linux because it is successful, unlike &#039;settimeofday&#039; which was created to change timezones (tz_dsttime) as well as the time but each occurrence of this field in the kernel source(apart for declaration) is a bug thus failing. (come back to) &lt;br /&gt;
&lt;br /&gt;
The second sub type is get/set system data. UNIX does this by....&lt;br /&gt;
&lt;br /&gt;
== Process Control Calls==&lt;br /&gt;
&lt;br /&gt;
== Communications Calls==&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous System Calls ==&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
Unix Programming Manual, http://cm.bell-labs.com/cm/cs/who/dmr/1stEdman.html, &lt;br /&gt;
&lt;br /&gt;
Linux Programmer&#039;s Manual, Linux man-pages project.&lt;br /&gt;
http://www.kernel.org/doc/man-pages/&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_1_2010_Question_2&amp;diff=3917</id>
		<title>COMP 3000 Essay 1 2010 Question 2</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_1_2010_Question_2&amp;diff=3917"/>
		<updated>2010-10-14T18:28:51Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Question=&lt;br /&gt;
How do the available system calls in modern versions of the Linux Kernel (2.6.30+) compare with the system calls available in the earliest versions of UNIX? How has the system call interface been expanded, and why? Focus on major changes or extensions in functionality.&lt;br /&gt;
&lt;br /&gt;
=Answer=&lt;br /&gt;
&lt;br /&gt;
A system call is a mean by which programs in the user space can access kernel services. Systems calls vary from operating system to operating system, although the underlying concepts tends to be the same. In general, a process is not supposed to be able to access the kernel directly. It can&#039;t access kernel memory and it can&#039;t call kernel functions. When the CPU prevents a process from accessing the kernel, this prevention is commonly known as, the protected mode. On the other hand, system calls are an exception to this rule. For example, older x86 processors used an interrupt mechanism to go from user-space to kernel-space, but newer processor (PentiumII+) provided instructions that optimize this transition using sysenter and sysexit instructions (Hayward, Mike. Intel P6 vs P7 system call performance. [http://lkml.org/lkml/2002/12/9/13], December 9, 2002).  All system calls are small programs built using the C programming language.&lt;br /&gt;
&lt;br /&gt;
The Unix and Linux systems calls are roughly grouped into 6 major categories: file management, device management, information maintenance, process control, communications and miscellaneous calls. The miscellaneous calls are all the ones that don’t really fit in the other categories, like system calls dealing with errors. Today, the Unix and Linux operating system contains hundreds of system calls but in general, they all came from the 35 system calls that came with one of the original UNIX OS in the early 70s. In the next paragraphs, we’re going to describe the various system calls in each of the categories mentioned above, their evolution through history (major changes in functionality) and a comparison with the earliest versions of UNIX.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== File Management Calls==&lt;br /&gt;
&lt;br /&gt;
The system calls in this group deal with every type of operation that is required to run a file system in the operating system. Create file, delete file, opening a file and closing a file are just a few examples of them and most of them hardly changed throughout the years. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;chmod&#039;&#039;, &#039;&#039;chown&#039;&#039; and &#039;&#039;chdir&#039;&#039; has been available since the earliest UNIX and it is still used in today’s Linux kernels. The &#039;&#039;chmod&#039;&#039; and &#039;&#039;chown&#039;&#039; calls allows the users to change the file attributes and implements security to the file system. The system call &#039;&#039;chdir&#039;&#039; allows the process to change the current working directory. In the 4th distribution of UNIX from Berkeley (4BSD), new system calls were added to be able to give more control on the file system to the applications. The call &#039;&#039;chroot&#039;&#039; allows the process to change the current root directory with one specified in a path argument. &#039;&#039;fchmod&#039;&#039; and &#039;&#039;fchdir&#039;&#039; are the same as &#039;&#039;chmod&#039;&#039; and &#039;&#039;chdir&#039;&#039; except it takes file descriptors as arguments. As of Linux kernel 2.1.81, the &#039;&#039;chown&#039;&#039; system call follows symbolic link and introduce a new system call, &#039;&#039;lchown&#039;&#039;, that does not follow symbolic links. As of Linux 2.6.16, &#039;&#039;fchownat&#039;&#039; and &#039;&#039;fchmodat&#039;&#039; was added. It operates the same way as &#039;&#039;chown&#039;&#039; and &#039;&#039;chmod&#039;&#039; but takes more arguments to deal with relative pathnames. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another four of the original UNIX system calls are &#039;&#039;open&#039;&#039;, &#039;&#039;creat&#039;&#039;, &#039;&#039;mkdir&#039;&#039; and &#039;&#039;close&#039;&#039;. The &#039;&#039;open&#039;&#039; and &#039;&#039;creat&#039;&#039; calls allows processes to open and possibly create a file or device. Arguments flags are used to set either access modes, like O_RDONLY(read-only), to status flags, like O_APPEND(append mode). The only modifications made to the system calls were the addition of status flags where some of them are only linux-specific. The &#039;&#039;close&#039;&#039; call allows processes to close a file descriptor preventing it to be reused. No changes were made to it. &#039;&#039;mkdir&#039;&#039; allows the creation of a file directory. At that point, to delete a directory, users would need to make a series of &#039;&#039;link&#039;&#039; and &#039;&#039;unlink&#039;&#039; system calls. With Unix 4.2BSD, &#039;&#039;rmdir&#039;&#039; and solved the problem. The &#039;&#039;rename&#039;&#039; call was also added in 4.2BSD allowing processes to change the name or the location of a file.As of Linux 2.6.16, &#039;&#039;openat&#039;&#039;, &#039;&#039;mkdirat&#039;&#039; and &#039;&#039;renameat&#039;&#039; was added. It for the same reasons as &#039;&#039;fchmodat&#039;&#039; and &#039;&#039;fchmownat&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is also system calls used to find, access and modify files. They are ’‘read’’, ‘‘write’’, ‘‘seek’’ and ‘‘stat’’. These were all part of earliest UNIX built. The ‘‘read’’ and ‘‘write’’ system calls allows to read and write from a file (assigned to a file descriptor). The only change was in SVR4 where a write can be interrupted at anytime. The ‘‘seek’’ system calls is used to go to a specified position in a file. This calls used a 16 bit address. But this was replaced very quickly for ‘‘lseek’’ as early as SVR4. It allows the call to use 32 bit addresses. It is still used in modern Linux and Unix systems even if developers are trying to implement ‘‘lseek64’’, a system call that will use 64 bit addresses. The ‘‘stat’’ system calls allows processes to get the status of a file. With SVR4, 2 other version of that system call were created: ‘‘fstat’’ and ‘‘lstat’’. They both do the same thing except ‘‘lstat’’ give the status of symbolic links and ‘‘fstat’’ give the status of a file specified by a file descriptor. Different operating systems will output different values to represent the state of a file. Since kernel 2.5.48, the stat returned a nanoseconds field in the file’s timestamp. The ‘‘fstatat’’ system call was added to Linux kernel 2.6.16. This is again for the same reason as ‘‘openat’’. With the release of 4.4BSD, two new system calls called ‘‘statvfs’’ and ‘‘fstatvfs’’ were introduced to provide information about a mounted file system. They both do the same thing except fstatvfs takes file descriptors as an argument. These calls are only used in an UNIX environment. In Linux, it has ‘‘statfs’’ and ‘‘fstatfs’’ to support that same call.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last two original UNIX system calls in this category that are still used today are &#039;&#039;link&#039;&#039; and &#039;&#039;unlink&#039;&#039;. &#039;&#039;link&#039;&#039; creates a hard link to an existing file and &#039;&#039;unlink&#039;&#039; deletes a file link’s name and possibly the file it refers to. If the name refers to a symbolic link, only the link is removed. No major changes were done to the &#039;&#039;unlink&#039;&#039; system calls but new system calls were create from &#039;&#039;link&#039;&#039;. The &#039;&#039;symlink&#039;&#039; system call was added in 4.2BSD to allow the creation of symbolic links in the file system. Again in Linux 2.6.16, &#039;&#039;linkat&#039;&#039; and &#039;&#039;unlinkat&#039;&#039; were added for the same reasons as &#039;&#039;openat&#039;&#039;, &#039;&#039;fchmadat&#039;&#039; and &#039;&#039;fchownat&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Device Management Calls==&lt;br /&gt;
&lt;br /&gt;
The device management system calls are linked to hardware and they are mainly used to requests for devices, release devices, to logically attach a device or to detach it, get and modified device attributes and read and write to them. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two of the most important system calls for the UNIX and Linux operating system is ‘‘mount’’ and ‘‘umount’’. These were among the few system calls available in UNIX in the 70s. The two calls allowed the operating system to load file systems on storage devices. A few changes were done to the mount system calls most of them were the creation of new mount flags to enhance performance. For example, since Linux 2.5.19, the MS_DIRSYNC flag permits the directory changes on a file system synchronous. Another Linux improvement was to provide per-process mount namespaces. This was added on the 2.4.19 kernel. If a process was created using clone() with the CLONE_NEWNS flag, the process will have a new namespace initialized to be a copy of the namespace of the process that was cloned. The ‘‘umount’’ system call unmounted the file system from the storage device. The only noteworthy change to ‘‘umount’’ was the creation of ‘‘umount2’’ in Linux 2.1.116. It is the same as ‘‘umount’’ except it allows different flags to control the operation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The ‘‘open’’, ‘‘read’’ and ‘‘write’’ calls can also be used to access devices. As discussed in the previous section, arguments flags are used to better control the device. You would use them as if the devices were files using the appropriate flags.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With the System V Unix revision 4(SVR4) came the system call ‘‘mmap’’. This system call is used to map or unmap files or devices into memory. Once a device is mapped, the system call returns a pointer to the mapped area allowing processes to access that device. This system call is still used in a Unix environment but since Linux 2.4, Linux replaced it by the mmap2 system call. It is basically the same as mmap except for a final argument specifying the offset into a file in 4096-byte units. This enables the mapping of large files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In version 7 of Unix, ‘‘ioctl’’ system call is used for device-specific operations that can’t be done using the standard system calls. This helps to deal with a multitude of devices. Each device drivers would provide a set of ioctl request code to allow various operations on their device. Each various request code are hardware dependent so there is no standard available for this system call.&lt;br /&gt;
&lt;br /&gt;
== Information Maintenance Calls==&lt;br /&gt;
Information maintenance calls are system calls that return the computers personal information back to the user or change it completely. These type of calls can be split up into three groups get/set time or date, get/set system data and get/set process,file, or device attributes. To fully understand the difference between Linux and UNIX in regrades to system call one must explore the three sub type of information maintenance calls and see how they have changed over time.&lt;br /&gt;
&lt;br /&gt;
The First sub type is Get/set of time and/or date, in Linux this can be done by a few different system call, there is: &#039;gettimeofday&#039; to get the time, &#039;settimeofday&#039; to set it, &#039;time&#039; returns the time in seconds. The earliest versions UNIX used the system call &#039;stime&#039; to interacted with time and dates. Stime could return the time and date and sets the system’s idea of the time and date by altering the seconds. &#039;stime&#039; is still being used by Linux because it is successful, unlike &#039;settimeofday&#039; which was created to change timezones (tz_dsttime) as well as the time but each occurrence of this field in the kernel source(apart for declaration) is a bug thus failing. (come back to) &lt;br /&gt;
&lt;br /&gt;
The second sub type is get/set system data. UNIX does this by....&lt;br /&gt;
&lt;br /&gt;
== Process Control Calls==&lt;br /&gt;
&lt;br /&gt;
== Communications Calls==&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous System Calls ==&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
Here is the original manual --[[User:Lmundt|Lmundt]] 18:29, 7 October 2010 (UTC)&lt;br /&gt;
http://cm.bell-labs.com/cm/cs/who/dmr/1stEdman.html&lt;br /&gt;
&lt;br /&gt;
Linux Programmer&#039;s Manual, Linux man-pages project.&lt;br /&gt;
http://www.kernel.org/doc/man-pages/&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_1_2010_Question_2&amp;diff=3912</id>
		<title>COMP 3000 Essay 1 2010 Question 2</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_1_2010_Question_2&amp;diff=3912"/>
		<updated>2010-10-14T18:25:27Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: /* Answer */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Question=&lt;br /&gt;
How do the available system calls in modern versions of the Linux Kernel (2.6.30+) compare with the system calls available in the earliest versions of UNIX? How has the system call interface been expanded, and why? Focus on major changes or extensions in functionality.&lt;br /&gt;
&lt;br /&gt;
=Answer=&lt;br /&gt;
&lt;br /&gt;
A system call is a mean by which programs in the user space can access kernel services. Systems calls vary from operating system to operating system, although the underlying concepts tends to be the same. In general, a process is not supposed to be able to access the kernel directly. It can&#039;t access kernel memory and it can&#039;t call kernel functions. When the CPU prevents a process from accessing the kernel, this prevention is commonly known as, the protected mode. On the other hand, system calls are an exception to this rule. For example, older x86 processors used an interrupt mechanism to go from user-space to kernel-space, but newer processor (PentiumII+) provided instructions that optimize this transition using sysenter and sysexit instructions (Hayward, Mike. Intel P6 vs P7 system call performance. [http://lkml.org/lkml/2002/12/9/13], December 9, 2002).  All system calls are small programs built using the C programming language.&lt;br /&gt;
&lt;br /&gt;
The Unix and Linux systems calls are roughly grouped into 6 major categories: file management, device management, information maintenance, process control, communications and miscellaneous calls. The miscellaneous calls are all the ones that don’t really fit in the other categories, like system calls dealing with errors. Today, the Unix and Linux operating system contains hundreds of system calls but in general, they all came from the 35 system calls that came with one of the original UNIX OS in the early 70s. In the next paragraphs, we’re going to describe the various system calls in each of the categories mentioned above, their evolution through history (major changes in functionality) and a comparison with the earliest versions of UNIX.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== File Management Calls==&lt;br /&gt;
&lt;br /&gt;
The system calls in this group deal with every type of operation that is required to run a file system in the operating system. Create file, delete file, opening a file and closing a file are just a few examples of them and most of them hardly changed throughout the years. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;chmod&#039;&#039;, &#039;&#039;chown&#039;&#039; and &#039;&#039;chdir&#039;&#039; has been available since the earliest UNIX and it is still used in today’s Linux kernels. The &#039;&#039;chmod&#039;&#039; and &#039;&#039;chown&#039;&#039; calls allows the users to change the file attributes and implements security to the file system. The system call &#039;&#039;chdir&#039;&#039; allows the process to change the current working directory. In the 4th distribution of UNIX from Berkeley (4BSD), new system calls were added to be able to give more control on the file system to the applications. The call &#039;&#039;chroot&#039;&#039; allows the process to change the current root directory with one specified in a path argument. &#039;&#039;fchmod&#039;&#039; and &#039;&#039;fchdir&#039;&#039; are the same as &#039;&#039;chmod&#039;&#039; and &#039;&#039;chdir&#039;&#039; except it takes file descriptors as arguments. As of Linux kernel 2.1.81, the &#039;&#039;chown&#039;&#039; system call follows symbolic link and introduce a new system call, &#039;&#039;lchown&#039;&#039;, that does not follow symbolic links. As of Linux 2.6.16, &#039;&#039;fchownat&#039;&#039; and &#039;&#039;fchmodat&#039;&#039; was added. It operates the same way as &#039;&#039;chown&#039;&#039; and &#039;&#039;chmod&#039;&#039; but takes more arguments to deal with relative pathnames. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another four of the original UNIX system calls are &#039;&#039;open&#039;&#039;, &#039;&#039;creat&#039;&#039;, &#039;&#039;mkdir&#039;&#039; and &#039;&#039;close&#039;&#039;. The &#039;&#039;open&#039;&#039; and &#039;&#039;creat&#039;&#039; calls allows processes to open and possibly create a file or device. Arguments flags are used to set either access modes, like O_RDONLY(read-only), to status flags, like O_APPEND(append mode). The only modifications made to the system calls were the addition of status flags where some of them are only linux-specific. The &#039;&#039;close&#039;&#039; call allows processes to close a file descriptor preventing it to be reused. No changes were made to it. &#039;&#039;mkdir&#039;&#039; allows the creation of a file directory. At that point, to delete a directory, users would need to make a series of &#039;&#039;link&#039;&#039; and &#039;&#039;unlink&#039;&#039; system calls. With Unix 4.2BSD, &#039;&#039;rmdir&#039;&#039; and solved the problem. The &#039;&#039;rename&#039;&#039; call was also added in 4.2BSD allowing processes to change the name or the location of a file.As of Linux 2.6.16, &#039;&#039;openat&#039;&#039;, &#039;&#039;mkdirat&#039;&#039; and &#039;&#039;renameat&#039;&#039; was added. It for the same reasons as &#039;&#039;fchmodat&#039;&#039; and &#039;&#039;fchmownat&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is also system calls used to find, access and modify files. They are ’‘read’’, ‘‘write’’, ‘‘seek’’ and ‘‘stat’’. These were all part of earliest UNIX built. The ‘‘read’’ and ‘‘write’’ system calls allows to read and write from a file (assigned to a file descriptor). The only change was in SVR4 where a write can be interrupted at anytime. The ‘‘seek’’ system calls is used to go to a specified position in a file. This calls used a 16 bit address. But this was replaced very quickly for ‘‘lseek’’ as early as SVR4. It allows the call to use 32 bit addresses. It is still used in modern Linux and Unix systems even if developers are trying to implement ‘‘lseek64’’, a system call that will use 64 bit addresses. The ‘‘stat’’ system calls allows processes to get the status of a file. With SVR4, 2 other version of that system call were created: ‘‘fstat’’ and ‘‘lstat’’. They both do the same thing except ‘‘lstat’’ give the status of symbolic links and ‘‘fstat’’ give the status of a file specified by a file descriptor. Different operating systems will output different values to represent the state of a file. Since kernel 2.5.48, the stat returned a nanoseconds field in the file’s timestamp. The ‘‘fstatat’’ system call was added to Linux kernel 2.6.16. This is again for the same reason as ‘‘openat’’. With the release of 4.4BSD, two new system calls called ‘‘statvfs’’ and ‘‘fstatvfs’’ were introduced to provide information about a mounted file system. They both do the same thing except fstatvfs takes file descriptors as an argument. These calls are only used in an UNIX environment. In Linux, it has ‘‘statfs’’ and ‘‘fstatfs’’ to support that same call.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last two original UNIX system calls in this category that are still used today are &#039;&#039;link&#039;&#039; and &#039;&#039;unlink&#039;&#039;. &#039;&#039;link&#039;&#039; creates a hard link to an existing file and &#039;&#039;unlink&#039;&#039; deletes a file link’s name and possibly the file it refers to. If the name refers to a symbolic link, only the link is removed. No major changes were done to the &#039;&#039;unlink&#039;&#039; system calls but new system calls were create from &#039;&#039;link&#039;&#039;. The &#039;&#039;symlink&#039;&#039; system call was added in 4.2BSD to allow the creation of symbolic links in the file system. Again in Linux 2.6.16, &#039;&#039;linkat&#039;&#039; and &#039;&#039;unlinkat&#039;&#039; were added for the same reasons as &#039;&#039;openat&#039;&#039;, &#039;&#039;fchmadat&#039;&#039; and &#039;&#039;fchownat&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Device Management Calls==&lt;br /&gt;
&lt;br /&gt;
The device management system calls are linked to hardware and they are mainly used to requests for devices, release devices, to logically attach a device or to detach it, get and modified device attributes and read and write to them. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two of the most important system calls for the UNIX and Linux operating system is ‘‘mount’’ and ‘‘umount’’. These were among the few system calls available in UNIX in the 70s. The two calls allowed the operating system to load file systems on storage devices. A few changes were done to the mount system calls most of them were the creation of new mount flags to enhance performance. For example, since Linux 2.5.19, the MS_DIRSYNC flag permits the directory changes on a file system synchronous. Another Linux improvement was to provide per-process mount namespaces. This was added on the 2.4.19 kernel. If a process was created using clone() with the CLONE_NEWNS flag, the process will have a new namespace initialized to be a copy of the namespace of the process that was cloned. The ‘‘umount’’ system call unmounted the file system from the storage device. The only noteworthy change to ‘‘umount’’ was the creation of ‘‘umount2’’ in Linux 2.1.116. It is the same as ‘‘umount’’ except it allows different flags to control the operation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The ‘‘open’’, ‘‘read’’ and ‘‘write’’ calls can also be used to access devices. As discussed in the previous section, arguments flags are used to better control the device. You would use them as if the devices were files using the appropriate flags.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With the System V Unix revision 4(SVR4) came the system call ‘‘mmap’’. This system call is used to map or unmap files or devices into memory. Once a device is mapped, the system call returns a pointer to the mapped area allowing processes to access that device. This system call is still used in a Unix environment but since Linux 2.4, Linux replaced it by the mmap2 system call. It is basically the same as mmap except for a final argument specifying the offset into a file in 4096-byte units. This enables the mapping of large files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In version 7 of Unix, ‘‘ioctl’’ system call is used for device-specific operations that can’t be done using the standard system calls. This helps to deal with a multitude of devices. Each device drivers would provide a set of ioctl request code to allow various operations on their device. Each various request code are hardware dependent so there is no standard available for this system call.&lt;br /&gt;
&lt;br /&gt;
== Information Maintenance Calls==&lt;br /&gt;
Information maintenance calls are system calls that return the computers personal information back to the user or change it completely. These type of calls can be split up into three groups get/set time or date, get/set system data and get/set process,file, or device attributes. To fully understand the difference between Linux and UNIX in regrades to system call one must explore the three sub type of information maintenance calls and see how they have changed over time.&lt;br /&gt;
&lt;br /&gt;
The First sub type is Get/set of time and/or date, in Linux this can be done by a few different system call, there is: &#039;gettimeofday&#039; to get the time, &#039;settimeofday&#039; to set it, &#039;time&#039; returns the time in seconds. The earliest versions UNIX used the system call &#039;stime&#039; to interacted with time and dates. Stime could return the time and date and sets the system’s idea of the time and date by altering the seconds. &#039;stime&#039; is still being used by Linux because it is successful, unlike &#039;settimeofday&#039; which was created to change timezones (tz_dsttime) as well as the time but each occurrence of this field in the kernel source(apart for declaration) is a bug thus failing. (come back to) &lt;br /&gt;
&lt;br /&gt;
The second sub type is get/set system data. UNIX does this by....&lt;br /&gt;
&lt;br /&gt;
== Process Control Calls==&lt;br /&gt;
&lt;br /&gt;
== Communications Calls==&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous System Calls ==&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
Here is the original manual --[[User:Lmundt|Lmundt]] 18:29, 7 October 2010 (UTC)&lt;br /&gt;
http://cm.bell-labs.com/cm/cs/who/dmr/1stEdman.html&lt;br /&gt;
&lt;br /&gt;
Linux Programmer&#039;s Manual, Linux man-pages project.&lt;br /&gt;
http://www.kernel.org/doc/man-pages/&lt;br /&gt;
&lt;br /&gt;
{{reflist}}&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_1_2010_Question_2&amp;diff=3908</id>
		<title>COMP 3000 Essay 1 2010 Question 2</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_1_2010_Question_2&amp;diff=3908"/>
		<updated>2010-10-14T18:24:20Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: /* Answer */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Question=&lt;br /&gt;
How do the available system calls in modern versions of the Linux Kernel (2.6.30+) compare with the system calls available in the earliest versions of UNIX? How has the system call interface been expanded, and why? Focus on major changes or extensions in functionality.&lt;br /&gt;
&lt;br /&gt;
=Answer=&lt;br /&gt;
&lt;br /&gt;
A system call is a mean by which programs in the user space can access kernel services. Systems calls vary from operating system to operating system, although the underlying concepts tends to be the same. In general, a process is not supposed to be able to access the kernel directly. It can&#039;t access kernel memory and it can&#039;t call kernel functions. When the CPU prevents a process from accessing the kernel, this prevention is commonly known as, the protected mode. On the other hand, system calls are an exception to this rule. For example, older x86 processors used an interrupt mechanism to go from user-space to kernel-space, but newer processor (PentiumII+) provided instructions that optimize this transition using sysenter and sysexit instructions (Hayward, Mike. [http://lkml.org/lkml/2002/12/9/13], December 9, 2002).  All system calls are small programs built using the C programming language.&lt;br /&gt;
&lt;br /&gt;
The Unix and Linux systems calls are roughly grouped into 6 major categories: file management, device management, information maintenance, process control, communications and miscellaneous calls. The miscellaneous calls are all the ones that don’t really fit in the other categories, like system calls dealing with errors. Today, the Unix and Linux operating system contains hundreds of system calls but in general, they all came from the 35 system calls that came with one of the original UNIX OS in the early 70s. In the next paragraphs, we’re going to describe the various system calls in each of the categories mentioned above, their evolution through history (major changes in functionality) and a comparison with the earliest versions of UNIX.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== File Management Calls==&lt;br /&gt;
&lt;br /&gt;
The system calls in this group deal with every type of operation that is required to run a file system in the operating system. Create file, delete file, opening a file and closing a file are just a few examples of them and most of them hardly changed throughout the years. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;chmod&#039;&#039;, &#039;&#039;chown&#039;&#039; and &#039;&#039;chdir&#039;&#039; has been available since the earliest UNIX and it is still used in today’s Linux kernels. The &#039;&#039;chmod&#039;&#039; and &#039;&#039;chown&#039;&#039; calls allows the users to change the file attributes and implements security to the file system. The system call &#039;&#039;chdir&#039;&#039; allows the process to change the current working directory. In the 4th distribution of UNIX from Berkeley (4BSD), new system calls were added to be able to give more control on the file system to the applications. The call &#039;&#039;chroot&#039;&#039; allows the process to change the current root directory with one specified in a path argument. &#039;&#039;fchmod&#039;&#039; and &#039;&#039;fchdir&#039;&#039; are the same as &#039;&#039;chmod&#039;&#039; and &#039;&#039;chdir&#039;&#039; except it takes file descriptors as arguments. As of Linux kernel 2.1.81, the &#039;&#039;chown&#039;&#039; system call follows symbolic link and introduce a new system call, &#039;&#039;lchown&#039;&#039;, that does not follow symbolic links. As of Linux 2.6.16, &#039;&#039;fchownat&#039;&#039; and &#039;&#039;fchmodat&#039;&#039; was added. It operates the same way as &#039;&#039;chown&#039;&#039; and &#039;&#039;chmod&#039;&#039; but takes more arguments to deal with relative pathnames. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another four of the original UNIX system calls are &#039;&#039;open&#039;&#039;, &#039;&#039;creat&#039;&#039;, &#039;&#039;mkdir&#039;&#039; and &#039;&#039;close&#039;&#039;. The &#039;&#039;open&#039;&#039; and &#039;&#039;creat&#039;&#039; calls allows processes to open and possibly create a file or device. Arguments flags are used to set either access modes, like O_RDONLY(read-only), to status flags, like O_APPEND(append mode). The only modifications made to the system calls were the addition of status flags where some of them are only linux-specific. The &#039;&#039;close&#039;&#039; call allows processes to close a file descriptor preventing it to be reused. No changes were made to it. &#039;&#039;mkdir&#039;&#039; allows the creation of a file directory. At that point, to delete a directory, users would need to make a series of &#039;&#039;link&#039;&#039; and &#039;&#039;unlink&#039;&#039; system calls. With Unix 4.2BSD, &#039;&#039;rmdir&#039;&#039; and solved the problem. The &#039;&#039;rename&#039;&#039; call was also added in 4.2BSD allowing processes to change the name or the location of a file.As of Linux 2.6.16, &#039;&#039;openat&#039;&#039;, &#039;&#039;mkdirat&#039;&#039; and &#039;&#039;renameat&#039;&#039; was added. It for the same reasons as &#039;&#039;fchmodat&#039;&#039; and &#039;&#039;fchmownat&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is also system calls used to find, access and modify files. They are ’‘read’’, ‘‘write’’, ‘‘seek’’ and ‘‘stat’’. These were all part of earliest UNIX built. The ‘‘read’’ and ‘‘write’’ system calls allows to read and write from a file (assigned to a file descriptor). The only change was in SVR4 where a write can be interrupted at anytime. The ‘‘seek’’ system calls is used to go to a specified position in a file. This calls used a 16 bit address. But this was replaced very quickly for ‘‘lseek’’ as early as SVR4. It allows the call to use 32 bit addresses. It is still used in modern Linux and Unix systems even if developers are trying to implement ‘‘lseek64’’, a system call that will use 64 bit addresses. The ‘‘stat’’ system calls allows processes to get the status of a file. With SVR4, 2 other version of that system call were created: ‘‘fstat’’ and ‘‘lstat’’. They both do the same thing except ‘‘lstat’’ give the status of symbolic links and ‘‘fstat’’ give the status of a file specified by a file descriptor. Different operating systems will output different values to represent the state of a file. Since kernel 2.5.48, the stat returned a nanoseconds field in the file’s timestamp. The ‘‘fstatat’’ system call was added to Linux kernel 2.6.16. This is again for the same reason as ‘‘openat’’. With the release of 4.4BSD, two new system calls called ‘‘statvfs’’ and ‘‘fstatvfs’’ were introduced to provide information about a mounted file system. They both do the same thing except fstatvfs takes file descriptors as an argument. These calls are only used in an UNIX environment. In Linux, it has ‘‘statfs’’ and ‘‘fstatfs’’ to support that same call.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last two original UNIX system calls in this category that are still used today are &#039;&#039;link&#039;&#039; and &#039;&#039;unlink&#039;&#039;. &#039;&#039;link&#039;&#039; creates a hard link to an existing file and &#039;&#039;unlink&#039;&#039; deletes a file link’s name and possibly the file it refers to. If the name refers to a symbolic link, only the link is removed. No major changes were done to the &#039;&#039;unlink&#039;&#039; system calls but new system calls were create from &#039;&#039;link&#039;&#039;. The &#039;&#039;symlink&#039;&#039; system call was added in 4.2BSD to allow the creation of symbolic links in the file system. Again in Linux 2.6.16, &#039;&#039;linkat&#039;&#039; and &#039;&#039;unlinkat&#039;&#039; were added for the same reasons as &#039;&#039;openat&#039;&#039;, &#039;&#039;fchmadat&#039;&#039; and &#039;&#039;fchownat&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Device Management Calls==&lt;br /&gt;
&lt;br /&gt;
The device management system calls are linked to hardware and they are mainly used to requests for devices, release devices, to logically attach a device or to detach it, get and modified device attributes and read and write to them. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two of the most important system calls for the UNIX and Linux operating system is ‘‘mount’’ and ‘‘umount’’. These were among the few system calls available in UNIX in the 70s. The two calls allowed the operating system to load file systems on storage devices. A few changes were done to the mount system calls most of them were the creation of new mount flags to enhance performance. For example, since Linux 2.5.19, the MS_DIRSYNC flag permits the directory changes on a file system synchronous. Another Linux improvement was to provide per-process mount namespaces. This was added on the 2.4.19 kernel. If a process was created using clone() with the CLONE_NEWNS flag, the process will have a new namespace initialized to be a copy of the namespace of the process that was cloned. The ‘‘umount’’ system call unmounted the file system from the storage device. The only noteworthy change to ‘‘umount’’ was the creation of ‘‘umount2’’ in Linux 2.1.116. It is the same as ‘‘umount’’ except it allows different flags to control the operation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The ‘‘open’’, ‘‘read’’ and ‘‘write’’ calls can also be used to access devices. As discussed in the previous section, arguments flags are used to better control the device. You would use them as if the devices were files using the appropriate flags.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With the System V Unix revision 4(SVR4) came the system call ‘‘mmap’’. This system call is used to map or unmap files or devices into memory. Once a device is mapped, the system call returns a pointer to the mapped area allowing processes to access that device. This system call is still used in a Unix environment but since Linux 2.4, Linux replaced it by the mmap2 system call. It is basically the same as mmap except for a final argument specifying the offset into a file in 4096-byte units. This enables the mapping of large files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In version 7 of Unix, ‘‘ioctl’’ system call is used for device-specific operations that can’t be done using the standard system calls. This helps to deal with a multitude of devices. Each device drivers would provide a set of ioctl request code to allow various operations on their device. Each various request code are hardware dependent so there is no standard available for this system call.&lt;br /&gt;
&lt;br /&gt;
== Information Maintenance Calls==&lt;br /&gt;
Information maintenance calls are system calls that return the computers personal information back to the user or change it completely. These type of calls can be split up into three groups get/set time or date, get/set system data and get/set process,file, or device attributes. To fully understand the difference between Linux and UNIX in regrades to system call one must explore the three sub type of information maintenance calls and see how they have changed over time.&lt;br /&gt;
&lt;br /&gt;
The First sub type is Get/set of time and/or date, in Linux this can be done by a few different system call, there is: &#039;gettimeofday&#039; to get the time, &#039;settimeofday&#039; to set it, &#039;time&#039; returns the time in seconds. The earliest versions UNIX used the system call &#039;stime&#039; to interacted with time and dates. Stime could return the time and date and sets the system’s idea of the time and date by altering the seconds. &#039;stime&#039; is still being used by Linux because it is successful, unlike &#039;settimeofday&#039; which was created to change timezones (tz_dsttime) as well as the time but each occurrence of this field in the kernel source(apart for declaration) is a bug thus failing. (come back to) &lt;br /&gt;
&lt;br /&gt;
The second sub type is get/set system data. UNIX does this by....&lt;br /&gt;
&lt;br /&gt;
== Process Control Calls==&lt;br /&gt;
&lt;br /&gt;
== Communications Calls==&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous System Calls ==&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
Here is the original manual --[[User:Lmundt|Lmundt]] 18:29, 7 October 2010 (UTC)&lt;br /&gt;
http://cm.bell-labs.com/cm/cs/who/dmr/1stEdman.html&lt;br /&gt;
&lt;br /&gt;
Linux Programmer&#039;s Manual, Linux man-pages project.&lt;br /&gt;
http://www.kernel.org/doc/man-pages/&lt;br /&gt;
&lt;br /&gt;
{{reflist}}&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_1_2010_Question_2&amp;diff=3907</id>
		<title>COMP 3000 Essay 1 2010 Question 2</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=COMP_3000_Essay_1_2010_Question_2&amp;diff=3907"/>
		<updated>2010-10-14T18:22:00Z</updated>

		<summary type="html">&lt;p&gt;Sblais2: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Question=&lt;br /&gt;
How do the available system calls in modern versions of the Linux Kernel (2.6.30+) compare with the system calls available in the earliest versions of UNIX? How has the system call interface been expanded, and why? Focus on major changes or extensions in functionality.&lt;br /&gt;
&lt;br /&gt;
=Answer=&lt;br /&gt;
&lt;br /&gt;
A system call is a mean by which programs in the user space can access kernel services. Systems calls vary from operating system to operating system, although the underlying concepts tends to be the same. In general, a process is not supposed to be able to access the kernel directly. It can&#039;t access kernel memory and it can&#039;t call kernel functions. When the CPU prevents a process from accessing the kernel, this prevention is commonly known as, the protected mode. On the other hand, system calls are an exception to this rule. For example, older x86 processors used an interrupt mechanism to go from user-space to kernel-space, but newer processor (PentiumII+) provided instructions that optimize this transition (using sysenter and sysexit instructions)&amp;lt;ref&amp;gt;Hayward, Mike. [http://lkml.org/lkml/2002/12/9/13], December 9, 2002&amp;lt;/ref&amp;gt;.  All system calls are small programs built using the C programming language.&lt;br /&gt;
&lt;br /&gt;
The Unix and Linux systems calls are roughly grouped into 6 major categories: file management, device management, information maintenance, process control, communications and miscellaneous calls. The miscellaneous calls are all the ones that don’t really fit in the other categories, like system calls dealing with errors. Today, the Unix and Linux operating system contains hundreds of system calls but in general, they all came from the 35 system calls that came with one of the original UNIX OS in the early 70s. In the next paragraphs, we’re going to describe the various system calls in each of the categories mentioned above, their evolution through history (major changes in functionality) and a comparison with the earliest versions of UNIX.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== File Management Calls==&lt;br /&gt;
&lt;br /&gt;
The system calls in this group deal with every type of operation that is required to run a file system in the operating system. Create file, delete file, opening a file and closing a file are just a few examples of them and most of them hardly changed throughout the years. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;chmod&#039;&#039;, &#039;&#039;chown&#039;&#039; and &#039;&#039;chdir&#039;&#039; has been available since the earliest UNIX and it is still used in today’s Linux kernels. The &#039;&#039;chmod&#039;&#039; and &#039;&#039;chown&#039;&#039; calls allows the users to change the file attributes and implements security to the file system. The system call &#039;&#039;chdir&#039;&#039; allows the process to change the current working directory. In the 4th distribution of UNIX from Berkeley (4BSD), new system calls were added to be able to give more control on the file system to the applications. The call &#039;&#039;chroot&#039;&#039; allows the process to change the current root directory with one specified in a path argument. &#039;&#039;fchmod&#039;&#039; and &#039;&#039;fchdir&#039;&#039; are the same as &#039;&#039;chmod&#039;&#039; and &#039;&#039;chdir&#039;&#039; except it takes file descriptors as arguments. As of Linux kernel 2.1.81, the &#039;&#039;chown&#039;&#039; system call follows symbolic link and introduce a new system call, &#039;&#039;lchown&#039;&#039;, that does not follow symbolic links. As of Linux 2.6.16, &#039;&#039;fchownat&#039;&#039; and &#039;&#039;fchmodat&#039;&#039; was added. It operates the same way as &#039;&#039;chown&#039;&#039; and &#039;&#039;chmod&#039;&#039; but takes more arguments to deal with relative pathnames. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another four of the original UNIX system calls are &#039;&#039;open&#039;&#039;, &#039;&#039;creat&#039;&#039;, &#039;&#039;mkdir&#039;&#039; and &#039;&#039;close&#039;&#039;. The &#039;&#039;open&#039;&#039; and &#039;&#039;creat&#039;&#039; calls allows processes to open and possibly create a file or device. Arguments flags are used to set either access modes, like O_RDONLY(read-only), to status flags, like O_APPEND(append mode). The only modifications made to the system calls were the addition of status flags where some of them are only linux-specific. The &#039;&#039;close&#039;&#039; call allows processes to close a file descriptor preventing it to be reused. No changes were made to it. &#039;&#039;mkdir&#039;&#039; allows the creation of a file directory. At that point, to delete a directory, users would need to make a series of &#039;&#039;link&#039;&#039; and &#039;&#039;unlink&#039;&#039; system calls. With Unix 4.2BSD, &#039;&#039;rmdir&#039;&#039; and solved the problem. The &#039;&#039;rename&#039;&#039; call was also added in 4.2BSD allowing processes to change the name or the location of a file.As of Linux 2.6.16, &#039;&#039;openat&#039;&#039;, &#039;&#039;mkdirat&#039;&#039; and &#039;&#039;renameat&#039;&#039; was added. It for the same reasons as &#039;&#039;fchmodat&#039;&#039; and &#039;&#039;fchmownat&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is also system calls used to find, access and modify files. They are ’‘read’’, ‘‘write’’, ‘‘seek’’ and ‘‘stat’’. These were all part of earliest UNIX built. The ‘‘read’’ and ‘‘write’’ system calls allows to read and write from a file (assigned to a file descriptor). The only change was in SVR4 where a write can be interrupted at anytime. The ‘‘seek’’ system calls is used to go to a specified position in a file. This calls used a 16 bit address. But this was replaced very quickly for ‘‘lseek’’ as early as SVR4. It allows the call to use 32 bit addresses. It is still used in modern Linux and Unix systems even if developers are trying to implement ‘‘lseek64’’, a system call that will use 64 bit addresses. The ‘‘stat’’ system calls allows processes to get the status of a file. With SVR4, 2 other version of that system call were created: ‘‘fstat’’ and ‘‘lstat’’. They both do the same thing except ‘‘lstat’’ give the status of symbolic links and ‘‘fstat’’ give the status of a file specified by a file descriptor. Different operating systems will output different values to represent the state of a file. Since kernel 2.5.48, the stat returned a nanoseconds field in the file’s timestamp. The ‘‘fstatat’’ system call was added to Linux kernel 2.6.16. This is again for the same reason as ‘‘openat’’. With the release of 4.4BSD, two new system calls called ‘‘statvfs’’ and ‘‘fstatvfs’’ were introduced to provide information about a mounted file system. They both do the same thing except fstatvfs takes file descriptors as an argument. These calls are only used in an UNIX environment. In Linux, it has ‘‘statfs’’ and ‘‘fstatfs’’ to support that same call.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last two original UNIX system calls in this category that are still used today are &#039;&#039;link&#039;&#039; and &#039;&#039;unlink&#039;&#039;. &#039;&#039;link&#039;&#039; creates a hard link to an existing file and &#039;&#039;unlink&#039;&#039; deletes a file link’s name and possibly the file it refers to. If the name refers to a symbolic link, only the link is removed. No major changes were done to the &#039;&#039;unlink&#039;&#039; system calls but new system calls were create from &#039;&#039;link&#039;&#039;. The &#039;&#039;symlink&#039;&#039; system call was added in 4.2BSD to allow the creation of symbolic links in the file system. Again in Linux 2.6.16, &#039;&#039;linkat&#039;&#039; and &#039;&#039;unlinkat&#039;&#039; were added for the same reasons as &#039;&#039;openat&#039;&#039;, &#039;&#039;fchmadat&#039;&#039; and &#039;&#039;fchownat&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Device Management Calls==&lt;br /&gt;
&lt;br /&gt;
The device management system calls are linked to hardware and they are mainly used to requests for devices, release devices, to logically attach a device or to detach it, get and modified device attributes and read and write to them. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Two of the most important system calls for the UNIX and Linux operating system is ‘‘mount’’ and ‘‘umount’’. These were among the few system calls available in UNIX in the 70s. The two calls allowed the operating system to load file systems on storage devices. A few changes were done to the mount system calls most of them were the creation of new mount flags to enhance performance. For example, since Linux 2.5.19, the MS_DIRSYNC flag permits the directory changes on a file system synchronous. Another Linux improvement was to provide per-process mount namespaces. This was added on the 2.4.19 kernel. If a process was created using clone() with the CLONE_NEWNS flag, the process will have a new namespace initialized to be a copy of the namespace of the process that was cloned. The ‘‘umount’’ system call unmounted the file system from the storage device. The only noteworthy change to ‘‘umount’’ was the creation of ‘‘umount2’’ in Linux 2.1.116. It is the same as ‘‘umount’’ except it allows different flags to control the operation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The ‘‘open’’, ‘‘read’’ and ‘‘write’’ calls can also be used to access devices. As discussed in the previous section, arguments flags are used to better control the device. You would use them as if the devices were files using the appropriate flags.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With the System V Unix revision 4(SVR4) came the system call ‘‘mmap’’. This system call is used to map or unmap files or devices into memory. Once a device is mapped, the system call returns a pointer to the mapped area allowing processes to access that device. This system call is still used in a Unix environment but since Linux 2.4, Linux replaced it by the mmap2 system call. It is basically the same as mmap except for a final argument specifying the offset into a file in 4096-byte units. This enables the mapping of large files.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In version 7 of Unix, ‘‘ioctl’’ system call is used for device-specific operations that can’t be done using the standard system calls. This helps to deal with a multitude of devices. Each device drivers would provide a set of ioctl request code to allow various operations on their device. Each various request code are hardware dependent so there is no standard available for this system call.&lt;br /&gt;
&lt;br /&gt;
== Information Maintenance Calls==&lt;br /&gt;
Information maintenance calls are system calls that return the computers personal information back to the user or change it completely. These type of calls can be split up into three groups get/set time or date, get/set system data and get/set process,file, or device attributes. To fully understand the difference between Linux and UNIX in regrades to system call one must explore the three sub type of information maintenance calls and see how they have changed over time.&lt;br /&gt;
&lt;br /&gt;
The First sub type is Get/set of time and/or date, in Linux this can be done by a few different system call, there is: &#039;gettimeofday&#039; to get the time, &#039;settimeofday&#039; to set it, &#039;time&#039; returns the time in seconds. The earliest versions UNIX used the system call &#039;stime&#039; to interacted with time and dates. Stime could return the time and date and sets the system’s idea of the time and date by altering the seconds. &#039;stime&#039; is still being used by Linux because it is successful, unlike &#039;settimeofday&#039; which was created to change timezones (tz_dsttime) as well as the time but each occurrence of this field in the kernel source(apart for declaration) is a bug thus failing. (come back to) &lt;br /&gt;
&lt;br /&gt;
The second sub type is get/set system data. UNIX does this by....&lt;br /&gt;
&lt;br /&gt;
== Process Control Calls==&lt;br /&gt;
&lt;br /&gt;
== Communications Calls==&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous System Calls ==&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
Here is the original manual --[[User:Lmundt|Lmundt]] 18:29, 7 October 2010 (UTC)&lt;br /&gt;
http://cm.bell-labs.com/cm/cs/who/dmr/1stEdman.html&lt;br /&gt;
&lt;br /&gt;
Linux Programmer&#039;s Manual, Linux man-pages project.&lt;br /&gt;
http://www.kernel.org/doc/man-pages/&lt;br /&gt;
&lt;br /&gt;
{{reflist}}&lt;/div&gt;</summary>
		<author><name>Sblais2</name></author>
	</entry>
</feed>