Sponsored Content
Full Discussion: Basic multithreaded program
Top Forums Programming Basic multithreaded program Post 302325287 by fpmurphy on Sunday 14th of June 2009 10:59:13 AM
Old 06-14-2009
What OS are you planning to use this program on? Can you control processor affinity on this OS?
 

9 More Discussions You Might Find Interesting

1. Programming

Getting errno in a Multithreaded program

In Tru64 Unix, the 'errno' variable is not thread safe. Could anybody help me about how to make it thread safe or how to check 'errno' in a Multithreaded program ???? The Programming process is like this. There are some definite number of threads having their own task. There is one... (2 Replies)
Discussion started by: S.Vishwanath
2 Replies

2. Programming

basic math program 4 child

Iam writing a script for my sisters friends little brother i want the program to say hello lets say his name is Joe and ask him how he is and he can write a reply back saying fine and then it replys "Iam happy you are (his response) today and then it goes into a basic math where he can put in a... (9 Replies)
Discussion started by: perleo
9 Replies

3. Shell Programming and Scripting

Having trouble writing a basic shell program

Hello. I'm trying to write a shell script that will take files that have .tar, .tar.gz, .tar.Z, .gz, .Z and .zip file extensions and uncompress and unarchive them. The script should be able to take multiple arguments. So far I can write a script using the case command that will do this but it will... (3 Replies)
Discussion started by: SeanWuzHere
3 Replies

4. Linux

getting problem in my code:::: plz help...(multithreaded appn with serial comm.)

hello, here I am copying my code... I am using two threads for reading and writing at com ports....one for reading and one for writing...in read thread I am using select() api....and polling again and again if there is some data to be read....but select is not returning any positive value so... (0 Replies)
Discussion started by: arunchaudhary19
0 Replies

5. Shell Programming and Scripting

execute command multithreaded util without programming

Hello all is there any way in unix to execute command in multithreaded way without doing it in java or cpp can one of the scripts handle multithread execution ? i need to test server requests ( corba ) in multithread Thanks (0 Replies)
Discussion started by: umen
0 Replies

6. UNIX for Advanced & Expert Users

forking in multithreaded program

hi all, i am using pthreads. What will happen if a thread does a fork? will all the threads are duplicated for the new process or only the called thread is duplicated? are the resources shared across the processes? thank you (0 Replies)
Discussion started by: skyrulz
0 Replies

7. HP-UX

Program monitor on BT-Basic

Hi, The "program monitor" command in BT-Basic prompt you for a user name and a password. How can I grant access only to certain users ? Thank you. (0 Replies)
Discussion started by: fosiceanu
0 Replies

8. Homework & Coursework Questions

Need help with Basic Unix Program

I am a newbie to UNIX. I'm learning UNIX on my own, just trying to get the jerk of how things work in UNIX environment. I am familiar with Windows environment. Can anyone pls write simple 'envprint' programs to : 1) List all the environment Information (using the -l or --l options) 2) ... (1 Reply)
Discussion started by: agup17
1 Replies

9. Homework & Coursework Questions

Log file analyzer, super basic sh program

Hello! I'd like some help with this assignment. 1. The problem statement, all variables and given/known data: 1)Write a shell script that can uses two types of files as inputs, apache.log and apache.error.log 2)Make it so that you can switch between the two file types 3)Make it so that the... (5 Replies)
Discussion started by: malfiory
5 Replies
lgrp_affinity_get(3LGRP)				 Locality Group Library Functions				  lgrp_affinity_get(3LGRP)

NAME
lgrp_affinity_get, lgrp_affinity_set - get of set lgroup affinity SYNOPSIS
cc [ flag ... ] file... -llgrp [ library ... ] #include <sys/lgrp_user.h> lgrp_affinity_t lgrp_affinity_get(idtype_t idtype, id_t id, lgrp_id_t lgrp); int lgrp_affinity_set(idtype_t idtype, id_t id, lgrp_id_t lgrp, lgrp_affinity_t affinity); DESCRIPTION
The lgrp_affinity_get() function returns the affinity that the LWP or set of LWPs specified by the idtype and id arguments have for the given lgroup. The lgrp_affinity_set() function sets the affinity that the LWP or set of LWPs specified by idtype and id have for the given lgroup. The lgroup affinity can be set to LGRP_AFF_STRONG, LGRP_AFF_WEAK, or LGRP_AFF_NONE. If the idtype is P_PID, the affinity is retrieved for one of the LWPs in the process or set for all the LWPs of the process with process ID (PID) id. The affinity is retrieved or set for the LWP of the current process with LWP ID id if idtype is P_LWPID. If id is P_MYID, then the current LWP or process is specified. The operating system uses the lgroup affinities as advice on where to run a thread and allocate its memory and factors this advice in with other constraints. Processor binding and processor sets can restrict which lgroups a thread can run on, but do not change the lgroup affinities. Each thread can have an affinity for an lgroup in the system such that the thread will tend to be scheduled to run on that lgroup and allo- cate memory from there whenever possible. If the thread has affinity for more than one lgroup, the operating system will try to run the thread and allocate its memory on the lgroup for which it has the strongest affinity, then the next strongest, and so on up through some small, system-dependent number of these lgroup affinities. When multiple lgroups have the same affinity, the order of preference among them is unspecified and up to the operating system to choose. The lgroup with the strongest affinity that the thread can run on is known as its "home lgroup" (see lgrp_home(3LGRP)) and is usually the operating system's first choice of where to run the thread and allocate its memory. There are different levels of affinity that can be specified by a thread for a particuliar lgroup. The levels of affinity are the follow- ing from strongest to weakest: LGRP_AFF_STRONG /* strong affinity */ LGRP_AFF_WEAK /* weak affinity */ LGRP_AFF_NONE /* no affinity */ The LGRP_AFF_STRONG affinity serves as a hint to the operating system that the calling thread has a strong affinity for the given lgroup. If this is the thread's home lgroup, the operating system will avoid rehoming it to another lgroup if possible. However, dynamic reconfig- uration, processor offlining, processor binding, and processor set binding and manipulation are examples of events that can cause the oper- ating system to change the thread's home lgroup for which it has a strong affinity. The LGRP_AFF_WEAK affinity is a hint to the operating system that the calling thread has a weak affinity for the given lgroup. If a thread has a weak affinity for its home lgroup, the operating system interpets this to mean that thread does not mind whether it is rehomed, unlike LGRP_AFF_STRONG. Load balancing, dynamic reconfiguration, processor binding, or processor set binding and manipulation are examples of events that can cause the operating system to change a thread's home lgroup for which it has a weak affinity. The LGRP_AFF_NONE affinity signifies no affinity and can be used to remove a thread's affinity for a particuliar lgroup. Initially, each thread has no affinity to any lgroup. If a thread has no lgroup affinities set, the operating system chooses a home lgroup for the thread with no affinity set. RETURN VALUES
Upon successful completion, lgrp_affinity_get() returns the affinity for the given lgroup. Upon successful completion, lgrp_affinity_set() return 0. Otherwise, both functions return -1 and set errno to indicate the error. ERRORS
The lgrp_affinity_get() and lgrp_affinity_set() functions will fail if: EINVAL The specified lgroup, affinity, or ID type is not valid. EPERM The effective user of the calling process does not have appropriate privileges, and its real or effective user ID does not match the real or effective user ID of one of the LWPs. ESRCH The specified lgroup or LWP(s) was not found. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
lgrp_home(3LGRP), liblgrp(3LIB), attributes(5) SunOS 5.10 16 Apr 2003 lgrp_affinity_get(3LGRP)
All times are GMT -4. The time now is 10:06 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy