LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 07-12-2008, 01:27 PM   #1
raedbenz
Member
 
Registered: Dec 2007
Posts: 93

Rep: Reputation: 15
process ,threads and system calls


Hi,
i am newbit to Linux. i have been reading many books and tutorials online about kernel and etc....
i feel like still i need a solid and simple example, that shows the difference among the three terms (process ,threads and system calls).
if we assume this "hello world" code:
Code:
#include <stdio.h>

int main(void)
{
	printf("Hello World");
	
	return 0;
}
In the above code which is the process? which is the thread and which the system call?
if u have a better example plz post it.
thanks
 
Old 07-12-2008, 01:47 PM   #2
AceofSpades19
Senior Member
 
Registered: Feb 2007
Location: Chilliwack,BC.Canada
Distribution: Slackware64 -current
Posts: 2,079

Rep: Reputation: 58
when you run that program it is a process and it is a new thread(AFAIK)
this sounds suspiciously like homework
 
Old 07-12-2008, 01:52 PM   #3
raedbenz
Member
 
Registered: Dec 2007
Posts: 93

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by AceofSpades19 View Post
when you run that program it is a process and it is a new thread(AFAIK)
this sounds suspiciously like homework
lol, actually its not homewrok,
where is the system call in here?
any better examples?
more over POSIX or ANSI C functions (like sigaction(),setitimer(),mmap() etc...)are considered threads or what?

thanks
 
Old 07-12-2008, 02:01 PM   #4
AceofSpades19
Senior Member
 
Registered: Feb 2007
Location: Chilliwack,BC.Canada
Distribution: Slackware64 -current
Posts: 2,079

Rep: Reputation: 58
Quote:
Originally Posted by raedbenz View Post
lol, actually its not homewrok,
where is the system call in here?
any better examples?
more over POSIX or ANSI C functions (like sigaction(),setitimer(),mmap() etc...)are considered threads or what?

thanks
Code:
#include <stdio.h>


int main(void){
system("echo hello");
return 0;
}
that makes a system call
a function call does not normally make a new thread
 
Old 07-12-2008, 02:09 PM   #5
raedbenz
Member
 
Registered: Dec 2007
Posts: 93

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by AceofSpades19 View Post
and it is a new thread(AFAIK)
k
well some processes have more than thread ,isn't it?
like what?
 
Old 07-12-2008, 02:57 PM   #6
AceofSpades19
Senior Member
 
Registered: Feb 2007
Location: Chilliwack,BC.Canada
Distribution: Slackware64 -current
Posts: 2,079

Rep: Reputation: 58
Quote:
Originally Posted by raedbenz View Post
well some processes have more than thread ,isn't it?
like what?
yes, a process can have more then one thread. Here are some links about threading
http://www.ibm.com/developerworks/library/l-posix1.html
http://arstechnica.com/articles/paed...rthreading.ars
 
Old 07-12-2008, 03:01 PM   #7
raedbenz
Member
 
Registered: Dec 2007
Posts: 93

Original Poster
Rep: Reputation: 15
HI,
sigaction() is system call or API?
setitimer() is system call or API?

thanks
 
Old 07-12-2008, 03:29 PM   #8
AceofSpades19
Senior Member
 
Registered: Feb 2007
Location: Chilliwack,BC.Canada
Distribution: Slackware64 -current
Posts: 2,079

Rep: Reputation: 58
Quote:
Originally Posted by raedbenz View Post
HI,
sigaction() is system call or API?
setitimer() is system call or API?

thanks
if you google those, I'm sure the results will tell you what they are
 
Old 07-12-2008, 03:31 PM   #9
raedbenz
Member
 
Registered: Dec 2007
Posts: 93

Original Poster
Rep: Reputation: 15
lol,
if i had not googled, then i would post a thread from the begging.
But bcoz i have some misconceptions thats y i posted this thread.
Unless u dont know the answer
 
Old 07-12-2008, 03:59 PM   #10
AceofSpades19
Senior Member
 
Registered: Feb 2007
Location: Chilliwack,BC.Canada
Distribution: Slackware64 -current
Posts: 2,079

Rep: Reputation: 58
sigaction() is part of the c library and setitimer() is a system call
 
Old 07-14-2008, 01:56 AM   #11
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
and, incidentally, system() is in fact a library call, not a system call
 
Old 07-14-2008, 02:06 AM   #12
raedbenz
Member
 
Registered: Dec 2007
Posts: 93

Original Poster
Rep: Reputation: 15
HI chrism,

AceofSpace19 said
Quote:
Code:
#include <stdio.h>
int main(void){
system("echo hello");
return 0;
}
that creates a system call
Quote:
Originally Posted by chrism01 View Post
and, incidentally, system() is in fact a library call, not a system call
How ?
 
Old 07-14-2008, 02:24 AM   #13
AceofSpades19
Senior Member
 
Registered: Feb 2007
Location: Chilliwack,BC.Canada
Distribution: Slackware64 -current
Posts: 2,079

Rep: Reputation: 58
Quote:
Originally Posted by chrism01 View Post
and, incidentally, system() is in fact a library call, not a system call
really?, I read that it was a system call
 
Old 07-14-2008, 04:10 AM   #14
fbianconi
Member
 
Registered: Apr 2008
Location: argentina
Distribution: Arch
Posts: 86

Rep: Reputation: 22
http://www.cs.cf.ac.uk/Dave/C/ this is a good book you can get started with.
Is from University of Leeds, and has an ugly copyright, but still readable online.
here can found more:
http://en.wikibooks.org/wiki/Programming:C
sorry can't edit links on ephy
 
Old 07-14-2008, 07:16 AM   #15
smoked kipper
Member
 
Registered: May 2008
Location: UK
Distribution: Slackware,Slamd64
Posts: 81

Rep: Reputation: 15
Code:
man man
System calls are documented in section 2, C libaray function in section 3.

Quote:
MANUAL SECTIONS
The standard sections of the manual include:

1 User Commands
2 System Calls
3 C Library Functions
4 Devices and Special Files
5 File Formats and Conventions
6 Games et. Al.
7 Miscellanea
8 System Administration tools and Deamons
 
  


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
how does java calls the system calls which are written in c babu198649 Linux - General 3 12-05-2011 03:40 AM
what happens to threads if i kill the process ? psh2001 Programming 4 08-11-2007 11:21 PM
Using system calls to create/context switch threads in assembly code casmac Programming 1 07-13-2007 04:48 PM
run process in background using system calls indian Programming 2 08-10-2004 05:03 PM
Threads And Process Penguinizer Programming 1 02-18-2003 09:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:05 PM.

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