03-14-2012
Implementing thread in UNIX
Hi
For our load testing , we are using stubs (unix shell script) which send the response to the request coming from the application. As the unix stub is single threaded , it is responding to only one request whereas multiple requests come in parallely.
I haven't worked on thread concepts till now. Would like to know if multithreading can be achieved in shell script for e.g if i start up the shell script process, multi thread can handle the parallel requests coming in and send response parallely.
Would be fo great if sample code snippet is given. Thanks in advance.
7 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Windows blows. I'm poor so unix is looking like a great alterative (expecially after my former roommate showed me most of the things it can do). Right now I'm looking at Debian or some other Unix kernel that would run nicley on my computer.
But the problem we had with installing it while he was... (3 Replies)
Discussion started by: beardsman
3 Replies
2. Forum Support Area for Unregistered Users & Account Problems
How to post a new thread (Regarding Unix related doubts) in Unix Forums.
I registered my id but I am unable to post my Questions to Forum.
Thanks & Regards,
indusri (1 Reply)
Discussion started by: indusri
1 Replies
3. UNIX Benchmarks
Type: UltraSPARC IIIi 1,593 Mhz x2
Ram: 16G
Disk: 2*70G fw scsi drives
Load: db application
kernel: Sunos5.10
pgms: compiled Sun cc -O2
==============================================================
BYTE UNIX Benchmarks (Version 3.11)
System -- SunOS sun.spmbox.com 5.10... (2 Replies)
Discussion started by: mr_manny
2 Replies
4. Shell Programming and Scripting
Hi,
I have a simulation program which creates two threads and I would like to know if I can measure the time of each individual thread. Threads communicate (I use pthread to manage them) and I want to measure communication time. I found a solution with clock_gettime and CLOCK_THREAD_CPUTIME_ID... (32 Replies)
Discussion started by: Tinkh
32 Replies
5. Shell Programming and Scripting
Hi This is continuation of previos thread
status=running
username=abc
password=123456
server=linux
The script was made which is used to capture the data from file
./scr test status
It will give result running
I have a case like
status = running
username=abc
password=123456... (14 Replies)
Discussion started by: parthmittal2007
14 Replies
6. Shell Programming and Scripting
Assume that 100 file's of type .txt are saved in directory
in which,
40 .txt files having ID 225 in column x
10 .txt files having ID 220 in column x
30 .txt files having ID 115 in column x
and remaining 20 .txt file's having UNIQUE ID say 226,227,228,229,230....first I want to read only files... (8 Replies)
Discussion started by: Akshay Hegde
8 Replies
7. Forum Support Area for Unregistered Users & Account Problems
If one enters a Google search query like
site:unix.com mysql php
and clicks on the resulting link, one gets the message below:
vBulletin Message
No Thread specified. If you followed a valid link, please notify the administrator (2 Replies)
Discussion started by: Unregistered
2 Replies
LEARN ABOUT OSF1
pthread_cancel
pthread_cancel(3) Library Functions Manual pthread_cancel(3)
NAME
pthread_cancel - Allows a thread to request a thread to terminate execution.
LIBRARY
DECthreads POSIX 1003.1c Library (libpthread.so)
SYNOPSIS
#include <pthread.h>
int pthread_cancel(
pthread_t thread);
STANDARDS
Interfaces documented on this reference page conform to industry standards as follows:
IEEE Std 1003.1c-1995, POSIX System Application Program Interface
PARAMETERS
Thread that receives a cancelation request.
DESCRIPTION
This routine sends a cancelation request to the specified target thread. A cancelation request is a mechanism by which a calling thread
requests the target thread to terminate as quickly as possible. Issuing a cancelation request does not guarantee that the target thread
will receive or handle the request.
When the cancelation request is acted on, all active cleanup handler routines for the target thread are called. When the last cleanup han-
dler returns, the thread-specific data destructor routines are called for each thread-specific data key with a destructor and for which the
target thread has a non-NULL value. Finally, the target thread is terminated.
Note that cancelation of the target thread runs asynchronously with respect to the calling thread's returning from pthread_cancel(3). The
target thread's cancelability state and type determine when or if the cancelation takes place, as follows: The target thread can delay can-
celation during critical operations by setting its cancelability state to PTHREAD_CANCEL_DISABLE. Because of communication delays, the
calling thread can only rely on the fact that a cancelation request will eventually become pending in the target thread (provided that the
target thread does not terminate beforehand). The calling thread has no guarantee that a pending cancelation request will be delivered
because delivery is controlled by the target thread.
When a cancelation request is delivered to a thread, termination processing is similar to that for pthread_exit(3). For more information
about thread termination, see the discussion of thread termination in pthread_create(3).
This routine is preferred in implementing an Ada abort statement and any other language- or software-defined construct for requesting
thread cancelation.
The results of this routine are unpredictable, if the value specified in thread refers to a thread that does not currently exist.
RETURN VALUES
If an error condition occurs, this routine returns an integer value indicating the type of error. Possible return values are as follows:
Successful completion. The specified thread is invalid. The thread argument does not specify an existing thread.
ERRORS
None
RELATED INFORMATION
Functions: pthread_cleanup_pop(3), pthread_cleanup_push(3), pthread_create(3), pthread_exit(3), pthread_join(3), pthread_setcancelstate(3),
pthread_setcanceltype(3), pthread_testcancel(3)
Manuals: Guide to DECthreads and Programmer's Guide
delim off
pthread_cancel(3)