09-09-2008
re
Hi ,
Mostly the diffrence is in execution time.threads require less time to execute,whereas the execution speed is more with processes.
you can get the user space/system space time using getrusage() function call.
By comparing the execution time you can decide between threads & processes.
But one more thing with threads you have to deal with synchronization.
best luck.
Raj
Quote:
Originally Posted by
rkalyankumar
I am just wondering on which is the best way to write programs on UNIX. Which one is better from below:
a) Spawning threads per client connection/request?
b) fork-exec new processes per client connection/request?
Assume that I am doing some database system on linux which is supposed to run on unix systems as well.
The basic differences as I know are:
Using processes - have it's own address space, communicate using SysV/POSIX shared memory + semaphores etc & context switching is costly. Also implementing processes instead of threads is that process are more stable and reliable than threads. Just because if one thread malfunctions, the entire process would break.
On the other side, using thread the context switching is less cheaper compared to that of process context switches. No need for shared memory as the memory is shared and accessible by all threads with in the process & hence can avoid costly IPC mechanism's like SysV/POSIX shared memory and semaphores. Instead use simple mutexes and condition variables.
Being said all the above, I am still not in a position to decide up on which way to go i.e. use threads or use processes?
Please help.
Regards
Kalyan
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
For a project we need to make sure that all php / html files in a certain directory on the webserver are showing advertisments of us.
For example, when you get a website from Lycos, you'll have an advertisement in the right corner.
How to?
As far as I can see, Lycos includes a javascript... (1 Reply)
Discussion started by: valentijnb
1 Replies
2. Shell Programming and Scripting
Hi Friends!!
I have obtained following output from a tool called pdftoxml:
<xml>
<text top="423" left="521" width="333" height="20" font="3">Although the the number of fuzzy rules of a system is </text>
<text top="441" left="500" width="355" height="20" font="3">directly dependant on these... (2 Replies)
Discussion started by: parshant_bvcoe
2 Replies
3. Shell Programming and Scripting
Hi all.
I do have a script "startApp.sh" (app result is a file /opt/extract/appextract.txt)
I have no problems with stopping app
var1=`ps -ef | grep -v grep | grep MyApp | awk '{print $2}'`
kill -9 $var1
What I want to achieve is:
I start app, app is doing some extraction, after... (11 Replies)
Discussion started by: e-l-diablo
11 Replies
4. Shell Programming and Scripting
I have a file which will have rows like shown below,
ST*820*316054716
RMR*IV*11333331009*PO*40.31
REF*IV*22234441009*xsss471-2762
DTM*003*091016
ENT*000006
RMR*IV*2222234444*PO*239.91
REF*IV*1234445451009*LJhjlkhkj471-2762 </SPAN>
DTM*003*
091016
RMR*IV*2223344441009*PO*40.31... (18 Replies)
Discussion started by: Muthuraj K
18 Replies
5. Shell Programming and Scripting
Hello All,
My script is nearly complete, there is just one last piece that needs to be added in.
I need to check for the time, and if it is lets say for example. Sunday at 5:00AM, my script cannot run.
I would assume it would be something like this, parden the terrible pseudocode
... (7 Replies)
Discussion started by: jeffs42885
7 Replies
6. Shell Programming and Scripting
Hi all,
I have to run C++ file using root programming, using following commands:
$root -l
root .L TwoTrees.C++
root TwoTrees t
root t.Loop()
root.q
I wonder if I can write script to do the following.
Thanks
Pooja (12 Replies)
Discussion started by: nrjrasaxena
12 Replies
7. Shell Programming and Scripting
i am stuck with this strange problem..... maybe you can help.
i have one master_file which has two column username and id_number separated by , somewhat like :
cat master_file :
sample,1234567
javacode,4567891
companion,23456719
adamsandler,1237681
tomcruise,56328910
bradpitt,901236781... (9 Replies)
Discussion started by: mukulverma2408
9 Replies
8. UNIX for Dummies Questions & Answers
Below is the sample logfile:
Userids Date Time
acb Checkout time: 2013-11-20 17:00
axy Checkout time: 2013-11-22 12:00
der Checkout time: 2013-11-17 17:00
xyz Checkout time: 2013-11-19 16:00
ddd Checkout time: 2013-11-21 16:00
aaa Checkout... (9 Replies)
Discussion started by: asjaiswal
9 Replies
9. Shell Programming and Scripting
I want to do FTP an Huge XML file to mainframe server using AIX server
Since my file size is huge, i want to split the XML file based on a delimiter , the record delimiter should be set after every 27000 bytes of data
and then do the ftp
This is done becos the data send to the mainframe must... (1 Reply)
Discussion started by: vishwanath001
1 Replies
10. Programming
Hi,
I am working in Visual studio 2008 in which i have written the code in c++,qml,qt.Its a simulator application.
I would like to create a simulator with certain changes. In order to do that i have modified the code with few changes based on the preprocessor condition.
#define... (4 Replies)
Discussion started by: SA_Palani
4 Replies
vxiod(1M) vxiod(1M)
NAME
vxiod - start, stop, and report on Veritas Volume Manager I/O threads
SYNOPSIS
vxiod
vxiod [-f ] [set count]
DESCRIPTION
The vxiod utility starts, stops, or reports on Veritas Volume Manager (VxVM) I/O kernel threads. An I/O thread provides a process context
for performing I/O in VxVM.
When the vxio module is loaded, 16 I/O threads are created, plus 2 threads per additional CPU for a system with more than 8 CPUs, up to a
maximum of 64 threads. At least one I/O thread must be running while the vxio module is loaded, and the number of I/O threads cannot be
forced to zero.
When invoked with no arguments, vxiod prints the current number of I/O threads to the standard output.
The number of threads that is required for handling I/O requests depends on the system load and usage. If volume recovery seems to proceed
more slowly at times, it may be possible to improve its performance by increasing the number of I/O threads up to a maximum of 64.
KEYWORDS
set When invoked with the set keyword, vxiod creates the number of I/O threads specified by count. If more volume I/O threads exist
than are specified by count, the excess processes terminate. If more than the maximum number(64) are specified, the requested
number is silently truncated to that maximum.
OPTIONS
-f This option has no effect from release 5.0 onward. The number of I/O threads cannot be reduced to zero.
EXIT CODES
The vxiod utility prints a diagnostic on the standard error, and exits if an error is encountered. If an I/O request occurs within a I/O
thread, the state of that I/O request is not reflected in the exit status for vxiod. Otherwise, vxiod returns a non-zero exit status on
error.
Usage errors result in an exit status of 1 and a usage message. If the requested number of threads cannot be created, the exit status is
2, and the number of threads that were successfully started is reported. If any other error occurs, the exit status is 3.
FILES
/dev/vx/iod The device used to report on and start volume I/O threads.
NOTES
Veritas Volume Manager I/O threads cannot be killed directly through the use of signals.
Depending on the operating system, VxVM I/O threads may not appear in the list of processes that is output by the ps command. The number
of I/O threads that is currently running can be determined by running vxiod.
SEE ALSO
fork(2), ps(1), vxconfigd(1M), vxdctl(1M), vxintro(1M), vxio(7), vxiod(7)
VxVM 5.0.31.1 24 Mar 2008 vxiod(1M)