Multitasking in korn shell


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Multitasking in korn shell
# 1  
Old 11-25-2003
Java Multitasking in korn shell

Hi,
I have to read a text file and start "N" number of programs
at a time in back ground.when any one of the job is completd
then i have to pass new job into that process.

How can i start Multiple jobs at a time?

How can i Track Jobs and move other jobs when one job is
completed?

Please solve my probelm....
# 2  
Old 11-25-2003
Sounds like a homework problem. If not, what is the actual problem you are trying to solve? What languages are you open to using. ksh does have job control - see the man page for bg and jobs and environment variable such as %%, %-, %+, %# etc.

http://docsrv.caldera.com:507/en/man....html#ksh_jobs

Cheers,

Keith
# 3  
Old 11-25-2003
I want to start multiple jobs at once and i must monitor which job
is completed trap that process Id and again i have to pass new
job to that process in back ground

Just Example psedocode of
1. Starting Multiple jobs at a time
2. Monitor the status of each job
3. When ever a job is completed pass a new job to process

That logic i want
# 4  
Old 11-25-2003
sureshraju_ma, ksh does not have the power to implement that in a robust manner. But there are some choices available to you...

My preferred solution would be to simply use the "at" command. It already has all of this built in. You will need to customize a queue and use the -q option on the at command. See "man queuedefs" for details.

Second, you could write your own c program that behaves somewhat like the "at" command. This would give you total control over the behavior of the program. I would only do this if the "at" command proved completely unsuitable for some reason.

Third, a very similiar thing could be done in ksh. You would write a "starter" script that somehow locates a job to run. If there are no jobs, it exits. If it finds a job, it execs that job. But each job would then need to exec the starter script at completion. Then you just launch n starter scripts.
# 5  
Old 11-25-2003
You aware of the c system calls like select and poll. you can use them for a very sturdy program.
# 6  
Old 11-25-2003
I don't see how select() or poll() would be helpful here. Can you explain your idea more fully?
# 7  
Old 11-28-2003
Question

How can i use select() and poll() to solve this problem?
Details please
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

New to korn shell

I am new to korn shell and slowly learning. Is there a way to have a parent script prompt for input and then execute a child script and return the output then move forward and ask for more input and then execute the next child script? I think the answer is no but thought i would ask. (2 Replies)
Discussion started by: cptkirkh
2 Replies

2. Shell Programming and Scripting

Bourne shell & Korn shell

Could some one tell me the difference btw Bourne shell and the Kshell? Which is more flexible and reliable in terms of portability and efficiency. When i type the following command .. $ echo $SHELL yields me /bin/sh Does this tells me that I am in Bourne shell. If yes, how can i get... (6 Replies)
Discussion started by: bobby1015
6 Replies

3. Shell Programming and Scripting

How to activate Korn Shell functionnalities in Bourne Shell

Hi All I have writing a Korn Shell script to execute it on many of our servers. But some servers don't have Korn Shell installed, they use Borne Shell. Some operations like calculation don't work : cat ${file1} | tail -$((${num1}-${num2})) > ${file2} Is it possible to activate Korn Shell... (3 Replies)
Discussion started by: madmat
3 Replies

4. Shell Programming and Scripting

korn shell

I am using korn shell but I want to have my prompt to represnent that of my C shell because I like it better. Is there anyway to do this? (1 Reply)
Discussion started by: vthokiefan
1 Replies

5. Shell Programming and Scripting

how to convert from korn shell to normal shell with this code?

well i have this code here..and it works fine in kornshell.. #!/bin/ksh home=c:/..../ input=$1 sed '1,3d' $input > $1.out line="" cat $1.out | while read a do line="$line $a" done echo $line > $1 rm $1.out however...now i want it just in normal sh mode..how to convert this?... (21 Replies)
Discussion started by: forevercalz
21 Replies

6. Programming

multiTasking using fork

i'm very new to UNIX C programming. I want to replace a very slow forloop in my program so that my tasks be run parallely: vector <string>inputs; ...populate inputs with 12 strings for (int i=0;i<12;i++) process(inputs); //process sends a request to remote network;takes up a lot of time; ... (3 Replies)
Discussion started by: mannoulla
3 Replies

7. Shell Programming and Scripting

KORN Shell - Spawn new shell with commands

I want to be able to run a script on one server, that will spawn another shell which runs some commands on another server.. I have seen some code that may help - but I cant get it working as below: spawn /usr/bin/ksh send "telnet x <port_no>\r" expect "Enter command: " send "LOGIN:x:x;... (2 Replies)
Discussion started by: frustrated1
2 Replies

8. Shell Programming and Scripting

Korn Shell

Hi I am new to shell programming. I need help to write a script to monitor a process on Sun OS. If the process fails then call a oracle procedure. i check the process if running by typing ps -ef | grep ESP | grep -v grep root 29002 1 0 Mar 18 ? 7:20... (4 Replies)
Discussion started by: gpanesar
4 Replies

9. Programming

Multitasking with fork()

Looking for a shell script to do the following : -- I have 100's of process to execute on Sun. -- These processes are not dependent on each other and can be executed in parallel. -- I cannot execute them ALL at once to avoid the system resource to be occupied by these processes. I want to... (1 Reply)
Discussion started by: vangaru
1 Replies

10. UNIX for Advanced & Expert Users

OpenBSD bad Multitasking?

Hi! Ive been following a OpenBSD thread from Dec 2003 "Issues multitasking during disk IO", and no "good" answer has still been given. I experience the same problems as he did. But ill explain my problem below for you who doesnt want to read a hole new thread. First off, i been using OpenBSD... (2 Replies)
Discussion started by: Tomtefan
2 Replies
Login or Register to Ask a Question