Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 06-26-2012, 12:32 PM   #1
LQ Newbie
Registered: Jun 2012
Distribution: CentOS6
Posts: 3

Rep: Reputation: Disabled
new system call implementation help

I have a project assignment that I need help with. The following is the description.
There are four system calls in Linux related to creating new processes: fork, vfork, execve, and clone. (The man pages will describe for you the differences among them.) Instrument the kernel so that we can write a user-level program that will print counts of the number of times each of these four system calls has been invoked (by any process on the system); that is, I want to write a garden-variety C program that prints out the total number of invocations of each of these four system calls (by any process on the system).

To do this requires three things:

***1. Modify the kernel to keep track of this information.***

***2. Design and implement a new system call that will get this data back to the user application.***

3. Write the user application.

We'd also like to be able to reset these statistics periodically. So we need a way to clear the request information we've tracked so far. This requires either parameterizing the above system call to add a clear option, or adding another system call.

I found these sources on how to add system calls in general.

***I need direction on how to do step 1 and step 2.***
Here is the full project description.

I have part one done.
This is an independent study assignment so there are no notes or lectures and I have no kernel development experience.

Also, I have the kernel source tree but am unable to make it because the memory space on the server is too low. So I will be unable to do any testing of the kernel until the administrator fixes the memory issue. The compiling was going along for almost an hour before space ran out. Is it normal for it to take that long?
Any help will be nice.
Old 06-26-2012, 09:37 PM   #2
Senior Member
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,039

Rep: Reputation: 1234Reputation: 1234Reputation: 1234Reputation: 1234Reputation: 1234Reputation: 1234Reputation: 1234Reputation: 1234Reputation: 1234
Linux does not run out of memory. Like every other modern OS it uses virtual memory. You ran out of swap space. The reason the compile took so long is that swapping to disk is slow. Increasing the swap space will allow your compile to complete (slowly). Adding more RAM will remove the need to swap so it will also make your build faster.

1) Increment a counter at the right place in each call.

2) Add a system call to read the counters. If you want an A instead of a C use locks to make sure that you don't read a counter while it is being updated or else use atomic operations.

Make sure you compile and run the UNMODIFIED kernel before making any changes. Otherwise you'll never figure out whether its something you changed or something wrong in what you started with.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to write a system call which returns current system time using call by reference mukul2kul4 Debian 2 09-25-2011 11:17 PM
System Call Implementation GodSendDeath *BSD 3 04-11-2005 05:06 PM
the procudre of implementation of system call in kernel 2.6 with example abhis_mail2002 Fedora 0 10-15-2004 10:17 AM
system call implementation.. modular approach udayan Programming 0 05-13-2002 11:46 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:50 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration