LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-11-2009, 06:21 AM   #1
shariefbe
Member
 
Registered: Aug 2008
Location: Tiruchirappalli, India
Distribution: UBUNTU 11.04
Posts: 368

Rep: Reputation: 31
diff between "system calls" and "kernel threads"


Hello,
May i know what is the difference between systems calls and kernel threads. I googled for the answer but as a newbie i didnt get understand what the difference?
 
Old 12-11-2009, 06:33 AM   #2
JohnGraham
Member
 
Registered: Oct 2009
Posts: 467

Rep: Reputation: 139Reputation: 139
Quote:
Originally Posted by shariefbe View Post
Hello,
May i know what is the difference between systems calls and kernel threads. I googled for the answer but as a newbie i didnt get understand what the difference?
They are two fundamentally different things:

1) A system call is a function call made from a program to a "system function" - these are functions like open() and sched_yield() that are specific to *nix (i.e. Windows would have different system calls).

2) A kernel thread is like a normal thread (i.e. independent thread of execution) except that it was spawned by a process in kernel-space.
 
Old 12-11-2009, 07:01 AM   #3
shariefbe
Member
 
Registered: Aug 2008
Location: Tiruchirappalli, India
Distribution: UBUNTU 11.04
Posts: 368

Original Poster
Rep: Reputation: 31
i understand what is system call is. But still i am confused about threads.
 
Old 12-11-2009, 12:05 PM   #4
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339

Rep: Reputation: 231Reputation: 231Reputation: 231
Quote:
Originally Posted by shariefbe View Post
i understand what is system call is. But still i am confused about threads.
Threads allow two diferent functions to execute at the same time.
Threads should be avoided when not necceray but used when you have to.
 
Old 12-13-2009, 08:44 AM   #5
resetreset
Senior Member
 
Registered: Mar 2008
Location: Cyberspace
Distribution: Dynebolic, Ubuntu 10.10
Posts: 1,340

Rep: Reputation: 62
the question is not what is different between the two, but what, if any, the SIMILARITY is - what made you think there is any?
 
Old 12-13-2009, 10:23 AM   #6
Recursion
LQ Newbie
 
Registered: Apr 2009
Posts: 27

Rep: Reputation: 17
A system call is a request of some application in user space, requesting the services of the kernel to carry out a given task it doesn't have the right or privilege to do. The system call comes from user space, signals a trap into kernel space and then if approved carries out the service for the user mode app. So as an example, lets say we have a non modern Linux kernel and want to read out memory. Newer kernels disable this by default, but it can be re-enabled. We can read from /dev/mem, and doing so takes many read system calls, as the user space doesn't have access to /dev/mem. To see the system calls you can do something like this

Quote:
sudo strace cat /dev/mem > /dev/null
A thread is the line of execution of a process. So lets say we create an application in C which is just a for loop that continually increments a variable by 1 to 1 million. The assembled version of that C app, will be numerous add instructions allowing the system to count to 1 million. All of those instructions are held in the processes thread of execution, and are executed one at a time. In older systems there was one thread per process, though in modern systems, each process can have as many threads as resources available. A process is just a program in execution by the way.

Last edited by Recursion; 12-13-2009 at 10:25 AM.
 
  


Reply



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
Feeding the output of "diff" or "cat" command to dpkg --purge kushalkoolwal Debian 9 06-19-2008 07:27 AM
Displaying "Subscribed Threads" -> new folder "All Folders" JZL240I-U LQ Suggestions & Feedback 5 06-15-2007 06:36 AM
Suggestion: for "subscribed threads" & "top of page" buttons Old_Fogie LQ Suggestions & Feedback 7 07-10-2006 05:10 PM
"My posts" and "My threads" should be exempt from the wait time before searches vharishankar LQ Suggestions & Feedback 6 03-06-2006 08:10 PM
"X-MS" cant open because "x-Multimedia System" cant access files at "smb&qu ponchy5 Linux - Networking 0 03-29-2004 11:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:55 AM.

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