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
PSET(3) 						   BSD Library Functions Manual 						   PSET(3)

NAME
pset_create, pset_assign, pset_bind, pset_destroy -- processor sets SYNOPSIS
#include <sys/pset.h> int pset_create(psetid_t *psid); int pset_assign(psetid_t psid, cpuid_t cpuid, psetid_t *opsid); int pset_bind(psetid_t psid, idtype_t type, id_t id, psetid_t *opsid); int pset_destroy(psetid_t psid); DESCRIPTION
The processor sets API provides the possibility to exclusively dedicate specific processors or groups of processors to processes or threads. After processes or threads are bound to a group of processors by the API, the group henceforth runs only those processes or threads. This section describes the functions used to control processor sets. FUNCTIONS
pset_create(psid) Creates a processor set, and returns its ID into psid. pset_assign(psid, cpu, opsid) Assigns the processor specified by cpuid to the processor set specified by psid. Stores the current processor set ID of the proces- sor or PS_NONE into opsid, if the pointer is not NULL. The following actions can be specified: 1. If psid is set to PS_QUERY, then the current processor set ID will be returned into psid, and no assignment will be per- formed. 2. If psid is set to PS_MYID, then the processor set ID of the calling process will be used, and psid will be ignored. 3. If psid is set to PS_NONE, any assignment to the processor will be cleared. pset_bind(psid, type, id, opsid) Dedicates the processor set specified by psid to the target specified by id. The current processor set ID to which the target is bound or PS_NONE will be returned in opsid, if the pointer is not NULL. NetBSD supports the following types of targets specified by type: P_PID Process identified by the PID. P_LWPID Thread of the calling process indentified by the LID. The following actions can be specified: 1. If psid is set to PS_QUERY, then the current processor set ID to which the target is bound or PS_NONE will be returned in opsid, and no binding will be performed. 2. If psid is set to PS_MYID, then the processor set ID of the calling process will be used. 3. If psid is set to PS_NONE, the specified target will be unbound from the processor set. pset_destroy(psid) Destroys the processor set specified by psid. Before destroying the processor set, all related assignments of the processors will be cleared, and all bound threads will be unbound. If psid is PS_MYID, the processor set ID of the caller thread will be used. IMPLEMENTATION NOTES
The pset_bind() function can return the current processor set ID to which the target is bound, or PS_NONE. However, for example, the process may have many threads, which could be bound to different processor sets. In such a case it is unspecified which thread will be used to return the information. There is an alternative thread affinity interface, see affinity(3). However, processor sets and thread affinity are mutually exclusive, hence mixing of these interfaces is prohibited. RETURN VALUES
Upon successful completion these functions return 0. Otherwise, -1 is returned and errno is set to indicate the error. EXAMPLES
An example of code fragment, which assigns the CPU whose ID is 0, for current process: psetid_t psid; cpuid_t ci = 0; if (pset_create(&psid) < 0) err(EXIT_FAILURE, "pset_create"); /* Assign CPU 0 to the processor-set */ if (pset_assign(psid, ci, NULL) < 0) err(EXIT_FAILURE, "pset_assign"); /* Bind the current process to the processor-set */ if (pset_bind(psid, P_PID, P_MYID, NULL) < 0) err(EXIT_FAILURE, "pset_bind"); /* * At this point, CPU 0 runs only the current process. */ perform_work(); if (pset_destroy(psid) < 0) err(EXIT_FAILURE, "pset_destroy"); ERRORS
The pset_create() function fails if: [ENOMEM] No memory is available for creation of the processor set, or limit of the allowed count of the processor sets was reached. [EPERM] The calling process is not the super-user. The pset_assign() function fails if: [EBUSY] Another operation is performing on the processor set. [EINVAL] psid or cpuid are invalid. [EPERM] The calling process is not the super-user, and psid is not PS_QUERY. The pset_bind() function fails if: [EBUSY] Another operation is performing on the processor set. [EINVAL] psid or type are invalid. [EPERM] The calling process is not the super-user, and psid is not PS_QUERY. [ESRCH] The specified target was not found. The pset_destroy() function fails if: [EBUSY] Another operation is performing on the processor set. [EPERM] The calling process is not the super-user. SEE ALSO
affinity(3), cpuset(3), sched(3), schedctl(8) STANDARDS
This API is expected to be compatible with the APIs found in Solaris and HP-UX operating systems. HISTORY
The processor sets appeared in NetBSD 5.0. BSD
May 6, 2010 BSD
All times are GMT -4. The time now is 01:40 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy