Sponsored Content
Full Discussion: scheduling a process
Top Forums Programming scheduling a process Post 47044 by a25khan on Sunday 1st of February 2004 11:28:46 PM
Old 02-02-2004
perderabo
for this program i had a loop:
if(x);
{
it='F'; stop = 'Z';
}
write(1,&it,1);
write(1,&stop,1);

the output of the program was:
abcdeFZFGHIJKLMNOPQRSTUVWXYZFZFGHIJKLMNOPQRSTUVWXYZ

i removed the ";" from the if(x); statement and this is my output when i run the program

abcdefzfghijklmnopqrstuvwxyzFZFGHIJKLMNOPQRSTUVWXYZ

as you said that it just kills some time, so i guess it shouldn't produce different output. can u comment on the new answer!

u also said that "You won't get the same results each time you run the program". but my results do not alter if ran with the same code.
i know i m jus missing one link here, can u help me figure that out
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

regarding the scheduling of the process

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

scheduling

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

Scheduling Policy Of Process

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

job/process scheduling or control

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

Adjust disk scheduling priority for a process?

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

Crontab scheduling

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

Process Scheduling where to start

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

Scheduling scheduling !!!

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

Need help regarding cronjob scheduling

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

Process Scheduling Information Extraction

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
getpriority(3C) 					   Standard C Library Functions 					   getpriority(3C)

NAME
getpriority, setpriority - get or set process scheduling priority SYNOPSIS
#include <sys/resource.h> int getpriority(int which, id_t who); int setpriority(int which, id_t who, int priority); DESCRIPTION
The getpriority() function obtains the current scheduling priority of a process, process group, or user. The setpriority() function sets the scheduling priority of a process, process group, or user. Target processes are specified by the values of the which and who arguments. The which argument can be one of the following values: PRIO_PROCESS, PRIO_PGRP, PRIO_USER, PRIO_GROUP, PRIO_SESSION, PRIO_LWP, PRIO_TASK, PRIO_PROJECT, PRIO_ZONE, or PRIO_CONTRACT, indicating that the who argument is to be interpreted as a process ID, a process group ID, an effective user ID, an effective group ID, a session ID, an lwp ID, a task ID, a project ID, a zone ID, or a process contract ID, respectively. A 0 value for the who argument specifies the cur- rent process, process group, or user. A 0 value for the who argument is treated as valid group ID, session ID, lwp ID, task ID, project ID, zone ID, or process contract ID. A P_MYID value for the who argument can be used to specify the current group, session, lwp, task, project, zone, or process contract, respectively. If more than one process is specified, getpriority() returns the highest priority (lowest numerical value) pertaining to any of the speci- fied processes, and setpriority() sets the priorities of all of the specified processes to the specified value. The default priority is 0; negative priorities cause more favorable scheduling. The range of valid priority values is [-20, 20]. If the value specified to setpriority() is less than the system's lowest supported priority value, the system's lowest supported value is used. If it is greater than the system's highest supported value, the system's highest supported value is used. Only a process with appropriate privileges can raise its priority (that is, assign a lower numerical priority value). Any processes or threads using SCHED_FIFO or SCHED_RR is unaffected by a call to setpriority(). This is not considered an error. A process that subsequently reverts to SCHED_OTHER need not have its priority affected by such a setpriority() call. RETURN VALUES
Upon successful completion, getpriority() returns an integer in the range from -20 to 20. Otherwise, -1 is returned and errno is set to indicate the error. Upon successful completion, setpriority() returns 0. Otherwise, -1 is returned and errno is set to indicate the error. ERRORS
The getpriority() and setpriority() functions will fail if: ESRCH No process could be located using the which and who argument values specified. EINVAL The value of the which argument was not recognized, or the value of the who argument is not a valid process ID, process group ID, user ID, group ID, session ID, lwp ID, task ID, project ID, or zone ID. In addition, setpriority() may fail if: EPERM A process was located, but neither the real nor effective user ID of the executing process is the privileged user or match the effective user ID of the process whose priority is being changed. EACCES A request was made to change the priority to a lower numeric value (that is, to a higher priority) and the current process does not have appropriate privileges. EXAMPLES
Example 1: Example using getpriority() The following example returns the current scheduling priority for the process ID returned by the call to getpid(2). #include <sys/resource.h> ... int which = PRIO_PROCESS; id_t pid; int ret; pid = getpid(); ret = getpriority(which, pid); Example 2: Example using setpriority() The following example sets the priority for the current process ID to -20. #include <sys/resource.h> ... int which = PRIO_PROCESS; id_t pid; int priority = -20; int ret; pid = getpid(); ret = setpriority(which, pid, priority); USAGE
The effect of changing the scheduling priority can vary depending on the process-scheduling algorithm in effect. Because getpriority() can return -1 on successful completion, it is necessary to set errno to 0 prior to a call to getpriority(). If get- priority() returns -1, then errno can be checked to see if an error occurred or if the value is a legitimate priority. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ SEE ALSO
nice(1), renice(1), fork(2), sched_get_priority_max(3RT), sched_setscheduler(3RT), attributes(5), standards(5) SunOS 5.10 19 Jul 2004 getpriority(3C)
All times are GMT -4. The time now is 10:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy