- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- System call
Operating System - HP-UX
1753773
Members
5258
Online
108799
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-30-2003 08:48 PM
тАО06-30-2003 08:48 PM
Hi,
What is the system call invoked when a new process needs to be created??
Thanks
Karthik
What is the system call invoked when a new process needs to be created??
Thanks
Karthik
For a list of all the ways technology has failed to improve the quality of life, please press three. - Alice Kahn
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-30-2003 08:58 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-30-2003 09:02 PM
тАО06-30-2003 09:02 PM
Re: System call
Hi,
The man page from fork (2) explains everything.
"The fork() system call causes the creation of a new process.
$ man fork
HTH
Michael
The man page from fork (2) explains everything.
"The fork() system call causes the creation of a new process.
$ man fork
HTH
Michael
Anyone for a Mutiny ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-30-2003 09:16 PM
тАО06-30-2003 09:16 PM
Re: System call
/* ----------------------------------------------------------------- */
/* FUNCTION child: */
/* This function takes 3 arguments(identity, life_time, ground). */
/* It forks a process, sleep for the life_time, the ground is used */
/* to decide whether wait or no wait. */
/* The new child ps shows its detail in both beginning and end time. */
/* ----------------------------------------------------------------- */
void child (char *identity, int life_time, char *ground) {
pid_t pid;
int status;
char buf[50];
time_t t1, t2;
struct tms childtim;
if ((pid = fork()) < 0) {
printf("*** ERROR: %d: forking %s process failed(Life time: %d)\n", getpid(), identity, life_time);
exit(1);
}
else if (pid == 0) { /* for the child process: */
time(&t1);
sprintf(buf, "\n %s process starts\n pid : %d\n ppid : %d\n start_at: %s \n", identity, getpid(), getppid(), asctime(localtime(&t1)));
write(1, buf, strlen(buf));
sleep(life_time);
time(&t2);
times( &childtim );
sprintf(buf, "\n %s process is about to exit\n pid : %d\n CPU_time: %d \n stop_at : %s \n", identity, getpid(), childtim.tms_utime, asctime(localtime(&t2)));
write(1, buf, strlen(buf));
exit(1);
}
else {
if (!strcmp(ground, "f")) {
while (wait(&status) != pid)
;
}
}
}
/* FUNCTION child: */
/* This function takes 3 arguments(identity, life_time, ground). */
/* It forks a process, sleep for the life_time, the ground is used */
/* to decide whether wait or no wait. */
/* The new child ps shows its detail in both beginning and end time. */
/* ----------------------------------------------------------------- */
void child (char *identity, int life_time, char *ground) {
pid_t pid;
int status;
char buf[50];
time_t t1, t2;
struct tms childtim;
if ((pid = fork()) < 0) {
printf("*** ERROR: %d: forking %s process failed(Life time: %d)\n", getpid(), identity, life_time);
exit(1);
}
else if (pid == 0) { /* for the child process: */
time(&t1);
sprintf(buf, "\n %s process starts\n pid : %d\n ppid : %d\n start_at: %s \n", identity, getpid(), getppid(), asctime(localtime(&t1)));
write(1, buf, strlen(buf));
sleep(life_time);
time(&t2);
times( &childtim );
sprintf(buf, "\n %s process is about to exit\n pid : %d\n CPU_time: %d \n stop_at : %s \n", identity, getpid(), childtim.tms_utime, asctime(localtime(&t2)));
write(1, buf, strlen(buf));
exit(1);
}
else {
if (!strcmp(ground, "f")) {
while (wait(&status) != pid)
;
}
}
}
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP