TASKS(3PVM)
π TASKS(3PVM) β bestie, let's go get the tea on your tasks π
okay so real talk, this is a page from PVM Version 3.4, and it's all about pvm_tasks β the little function that spills everything about the tasks chillin' on your virtual machine. no cap, it's basically the β¨source codeβ¨ behind the console ps command, so you already know it's iconic.
πΈ NAME πΈ
pvm_tasks β returns information about the tasks running on the virtual machine. periodt. that's the whole gig.
β¨ SYNOPSIS β¨
so here's how you call her in C:
int info = pvm_tasks( int where, int *ntask, struct pvmtaskinfo **taskp )
struct pvmtaskinfo {
int ti_tid;
int ti_ptid;
int ti_host;
int ti_flag;
char *ti_a_out;
} taskp;
and in Fortran:
call pvmftasks( where, ntask, tid, ptid, dtid, flag, aout, info )
likeβ¦ she serves both languages, we love a bilingual queen π«Ά
π PARAMETERS π
whereβ an Integer that says which tasks you wanna hear about. the options are, and I need you to focus bestie:0β for all the tasks on the virtual machine π- pvmd tid β for all tasks on a given host π
- tid β for a specific task, just the one, main character energy π
ntaskβ an Integer that returns the number of tasks being reported on. like, the headcount fr fr.taskpβ returns a pointer to an array of structures holding info about each task: its task ID, parent tid, pvmd task ID, status flag, and the name of this task's executable file. the status flag values are: waiting for a message, waiting for the pvmd, and running. three moods, honestly relatable πtidβ Integer returning task ID of one task.ptidβ Integer returning parent task ID. yes bestie, we're tracking the parents too π§dtidβ Integer returning pvmd task ID of host task is on.flagβ Integer returning status of task.aoutβ a Character string returning the name of the spawned task. but lowkey β manually started tasks return blank. empty. nada. πinfoβ the Integer status code returned by the routine. values less than zero mean an error happened, so if you see a negative, something's giving "we have a problem" π
π DESCRIPTION π
so pvm_tasks returns information about tasks presently running on the virtual machine. and here's the slay: the information it hands you is literally the same stuff you'd get from the console command ps. same tea, different mug β
the C function is the overachiever β it returns info about the entire virtual machine in one single call. one and done, ate that.
the Fortran function is more of a slow-burn girlie: she returns information about one task per call and cycles through all the tasks. so if where = 0, and you call pvmftasks ntask times, all the tasks will be represented. it's givingβ¦ patience π
heads up bestie: in Fortran, the reported value ofntaskand the set of tasks do not change until the function resets at the end of a complete cycle. but you can resetpvmftasks()at any time by calling it withntask = -1. boom, fresh start β¨
if pvm_tasks is successful, info will be 0. if some error occurs, then info will be < 0. no in-between, she doesn't do ambiguity π
π¦ EXAMPLES π¦
C:
struct pvmtaskinfo *taskp;
int i, ntask;
info = pvm_tasks( 0, &ntask, &taskp );
for (i = 0; i < ntask; i++)
printf("t%x\n", taskp[i].ti_tid);
Fortran:
Do i=1, NTASK
CALL PVMFTASKS( DTID, NTASK, TID(i), PTID(i), DTID(i),
& FLAG(i), AOUT(i), INFO )
EndDo
see? not scary. you got this. π
π ERRORS π
here's the part where things can go sideways. the following error condition can be returned by pvm_tasks:
PvmBadParamβ invalid value forwhereargument. you gave her something she doesn't recognize, bestie πPvmSysErrβ pvmd not responding. she's ghosting you fr fr π»PvmNoHostβ specified host not in virtual machine. that host? not invited to the party π«
π SEE ALSO π
go read these next, they're the supporting cast:
pvm_config(3PVM)pvm_tidtohost(3PVM)
and that's the whole page, no crumbs left π this was PVM Version 3.4, dated 31 August, 1994 β yes she's an elder but she still serves, iykyk. stan a vintage icon. πβ¨
π¦ where this page comes from
- debian bookworm: pvm-dev 3.4.6-5
- ubuntu jammy: pvm-dev 3.4.6-3.2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms