02-01-2004
scheduling a process
hi there i m having a confusion here with the looping in this example below. can someone help me out!?
#include<stdio.h>
main()
{
char it = 'a';
char stop = 'z';
int x,ret;
for(; it<'f';it++)
{
// for(x=0; x<32000;x++)
write(1,&it,1);
}
x=fork();
if(x);
{
it='F'; stop = 'Z';
}
write(1,&it,1);
write(1,&stop,1);
for(; it<=stop;it++)
{
for(x=0;x<32000;x++);
write(1,&it,1);
}
}
=======================
heres my output
: abcdeFZFGHIJKLMNOPQRSTUVWXYZFZFGHIJKLMNOPQRSTUVWXYZ
for this example i have, the text says it is an example of "sheduling of a process". i can't really sort out why does it say so?
can someone tell me whats the difference between having
for(; it<'f';it++)
{
for(x=0; x<32000;x++)
write(1,&it,1);
}
and
for(; it<'f';it++)
{
for(x=0; x<32000;x++); //i don't get this part!
write(1,&it,1); //how does write work
}
also a similar question
if(x);
{
any code
}
and
if(x)
{
any code
}
Thank you
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hello,
I would like to schedule a command at a specific time on my system.I know that theres a file named at.alow and at.deny in my system. I can find the at.deny file but not an at.allow file .
Is there anyway out or i have to go and talk to the system administrator itself , or any other way of... (1 Reply)
Discussion started by: prashantuc
1 Replies
2. UNIX for Dummies Questions & Answers
i have tried to schedule my process at a certain time using the at command :
the error says bad time specification
can somebody help me
i used at 2300 job
thanks (2 Replies)
Discussion started by: prashantuc
2 Replies
3. UNIX for Advanced & Expert Users
Hello
How to know the scheduling policy of the process in
HP-UX. (1 Reply)
Discussion started by: manjunath
1 Replies
4. Shell Programming and Scripting
Hi forum,
I have a problem concerning job or process scheduling and control.
I have to run 24 jobs (could be more sometimes less) of the same programme with different parameters. The machine this code is running on is an 8-core machine, so I was thinking that running all the processes at once... (0 Replies)
Discussion started by: deiphon
0 Replies
5. AIX
Hi all!
Some dumb administrator run the weekly backup "by hand" on our AIX 5.3 server, which we use to deploy Websphere applications, during work hours. Using the server while the backup is taking place is almost imposible. Both the disks are working at 100% and it's almost unusable. Asking the... (2 Replies)
Discussion started by: shandrio
2 Replies
6. Shell Programming and Scripting
Hi all,
My OS is Solaris 10. I want to schedule a job which i need to run between morining 6 to eve 6 once for every 2 hours. This is what i did.
0 6-18 * * 1-5 /monitor.sh
It runs for every hour how to make it for every two hours ......
Thanks,
Firestar. (1 Reply)
Discussion started by: firestar
1 Replies
7. UNIX for Dummies Questions & Answers
Hello, i'm absolutely new to the whole Operating Systems thing. I am pretty much level 0.
My assignment is to "simulate the execution of a stream of processes by a computer system, one CPU, many terminals 12 disk drives, 30 public mailboxes.
The professor runs a series of inputs which is a... (1 Reply)
Discussion started by: JaneSkylar
1 Replies
8. Shell Programming and Scripting
Hi,
i have 10 sh scripts. All are running in parallel using cron tab and each script gives "success" flag files once the execution is completed.
and, now i have 11th script which should look for "success" flag from those 10 sh scripts. once all the 10 flag files found, 11 th script has to do... (9 Replies)
Discussion started by: nago123
9 Replies
9. UNIX for Dummies Questions & Answers
Hello All,
I have three requirements to schedule three shell scripts in crontab.
Could you please help me in this:
1) To schedule a shell script every 5mins interval every day between 10PM to 10:30PM
2) To schedule a shell script every 10min interval every day between 9AM to 10AM.
3) To... (6 Replies)
Discussion started by: abhi_123
6 Replies
10. Shell Programming and Scripting
I want to extract the process having highest utilization on each processor core
and then output its information (PID etc.) to a file. How can I do it by using either top or ps command?
Thanks. (1 Reply)
Discussion started by: Vaibhavs1985
1 Replies
LEARN ABOUT OSF1
get_proplist_entry
get_proplist_entry(3) Library Functions Manual get_proplist_entry(3)
NAME
get_proplist_entry - Initializes pointers to the corresponding entries in an Extended File Attribute buffer
SYNOPSIS
#include <sys/proplist.h> int get_proplist_entry ( char **name, int **flags, int **value_size, char **value, char
**bufptr );
PARAMETERS
Points to the Extended File Attribute name.
Points to the system-wide file attributes for Extended File Attribute entries in the Property List.
Points to the size in bytes of the Extended File Attribute value.
Points to the Extended File Attribute value.
Points to the Extended File Attribute buffer.
DESCRIPTION
The get_proplist_entry function initializes the **name, **value_size, and **value parameters with the corresponding values in the Extended
File Attribute buffer pointed to by **bufptr. The function can be called repeatedly, because it advances the Extended File Attribute buf-
fer pointer **bufptr to the end of the current entry. An Extended File Attribute is a name and value pair that is contained in a variable-
sized structure called a Property List. A Property List is part of a file's metadata and can contain abstract name and value pairs
(Extended File Attributes) that can be set either by the operating system (for example, ACLs and privileges) or by a user-level application
(for example, PC File Attributes).
This function should be used to parse the Extended File Attribute buffer returned by the getproplist(3) function.
EXAMPLES
#include <sys/proplist.h> main() { char *ptr, *buf, *name, *value; int *value_len, *flags, buffer_size, min_buffer_size, ret, nbytes; struct pro-
plistname_args; static char *names[] = { "primary_name", "secondary_name", "" }; /*
* How big a buffer do I need to store my name and value
* pair in a property list ?
*/ buffer_size = sizeof_proplist_entry("primary_name", 18); buffer_size += sizeof_proplist_entry("secondary_name", 13); /*
* Malloc the buffer
*/ buf = ptr = (char *)malloc(buffer_size);
.
.
.
again: /*
* Call the system call to load buffer with property list
* entries.
*/ ret = getproplist("/tmp/foo", &getargs, buffer_size, buf, &min_buffer_size); if (ret < 0) { perror("getproplist");
free(buf); exit(1); } /*
* If buffer_size is not sufficient to store the name and value
* pairs, malloc a bigger buffer and try again.
*/ if (ret == 0 && min_buffer_size) {
free(buf);
buf = (char *)malloc(min_buffer_size);
buffer_size = min_buffer_size;
goto again; } /*
* Buffer contains ret bytes of name and value pairs
*/ ptr = buf; while (ret > 0) { /* * Call getproplist_entry to initialize name and value * pointers to entries position within
buffer. */ ret -= get_proplist_entry(&name, &flags, &value_len, &value, &ptr); printf("name %s value len %d
value %s0, name, *value_len, value); }
.
.
.
RETURN VALUES
If successful, the function returns the size of the current Extended File Attribute in the Property List.
RELATED INFORMATION
Functions: add_proplist_entry(3), delproplist(3), fdelproplist(3), fgetproplist(3), fsetproplist(3), get_proplist_entry(3), getproplist(3),
setproplist(3), sizeof_proplist_entry(3).
Files: proplist(4), sys/proplist.h.
delim off
get_proplist_entry(3)