Sponsored Content
Full Discussion: Help with multithreading
Top Forums Programming Help with multithreading Post 302747755 by fwrlfo on Saturday 22nd of December 2012 06:45:06 PM
Old 12-22-2012
Help with multithreading

I take this question of the The Linux Programming Interface:
Code:
 A Linux and Unix System Programming page 652 exercise 30.1

I want someone to explain the under line statement because it sounds complex to me couldn't understand anything

30-1 Modify the program (thread_incr.c) so that each loop in the thread’s start function outputs the current value of glob and some identifier that uniquely identifies the thread.

Code:
The unique identifier for the thread could be specified as an argument to the pthread_create()
call used to create the thread. For this program, that would require changing the argument 
of the thread’s start function to be a pointer to a structure containing the unique identifier 
and a loop limit value.

Run the program, redirecting output to a file, and then inspect the
file to see what happens to glob as the kernel scheduler alternates execution between the
two threads.

Last edited by jim mcnamara; 12-22-2012 at 09:48 PM..
This User Gave Thanks to fwrlfo For This Post:
 

9 More Discussions You Might Find Interesting

1. Programming

Multithreading in Pro*C

:confused: Hi! I have created a Multhreaded Application in Pro*C (using pthreads) with about 5 Threads running simultaneously. The Application is basically to Update a Centralized Table in Oracle, which updates different rows in the Table (Each Thread updates different rows!). The... (16 Replies)
Discussion started by: shaik786
16 Replies

2. Programming

multithreading on OSX

Hi all, I have a query about multithreading. What I would like to do is, at the start of my main update() function, start a couple of threads in parallel, once they are all complete carry on with my main update function. void update() { thread1->update(); // fluid solver ... (3 Replies)
Discussion started by: memoid
3 Replies

3. UNIX for Advanced & Expert Users

multithreading in UNIX

Hi, Can you please give me a suitable reference to learn multithreading programming in C in UNIX? Thanks (3 Replies)
Discussion started by: naan
3 Replies

4. Shell Programming and Scripting

Multithreading program

Hi I need to insert 1million records into MySQL database, but it is taking lot of time as there is no bulk insert support. I want to spawn 10 processes which will insert 100k records each parallely. Can somebody help me with a example program to execute this task through shell scripting. (5 Replies)
Discussion started by: sach_roger
5 Replies

5. Programming

MultiThreading using Pthreads

Situation: i have multiple pthread_create calls like this: pthread_create(...., ThreadFunc1,.....); pthread_create(...., ThreadFunc2,.....); . . which i am using to create multiple threads.All the "ThreadFunc<i>" functions are actually calling same function "Receive" of a class using same... (3 Replies)
Discussion started by: Sastra
3 Replies

6. IP Networking

how to do udp broadcast with multithreading

hello to all i want to use multithreading to my UDP broadcast server client program. will anyone help me by proving C code. i am working in fedora. also my requirement is POSIX compliance.please help me..... (0 Replies)
Discussion started by: moti12
0 Replies

7. Programming

how to do udp broadcast with multithreading

hello to all i want to use multithreading to my UDP broadcast server client program. will anyone help me by proving C code. i am working in fedora. also my requirement is POSIX compliance.please help me..... (6 Replies)
Discussion started by: moti12
6 Replies

8. Programming

Multithreading in reading file

Dear all, I am having a huge XML file, as below structure <EMPLOYEE> <RECORD id =aaa> <Salary>99999</Salary> <section>ssss</section> </RECORD> <RECORD id =bbb> <Salary>77777</Salary> <section>ssss</section> </RECORD> </EMPLOYEE> This is a 50 GB file I want to read this file in... (9 Replies)
Discussion started by: arunkumar_mca
9 Replies

9. What is on Your Mind?

Alarm interrupt and multithreading

Hi Friends any know how became a friend in this Android Programming Language (0 Replies)
Discussion started by: ljarun
0 Replies
iv_thread(3)						    ivykis programmer's manual						      iv_thread(3)

NAME
iv_thread_create, iv_thread_set_debug_state - ivykis thread convenience functions SYNOPSIS
#include <iv_thread.h> int iv_thread_create(char *name, void (*start_routine)(void *), void *arg); void iv_thread_set_debug_state(int state); DESCRIPTION
iv_thread_create is a wrapper around pthread_create(3) which will maintain an ivykis main loop reference in the calling thread (which must be an ivykis(3) thread, i.e. have had iv_init(3) called in it) for as long as the created thread is alive. Maintaining a reference on the calling thread's ivykis event loop makes sure that the calling thread will not return from its ivykis main loop before the created thread exits, as that could cause cleanup still happening in the created thread to be interrupted when the calling thread subsequently calls exit(3). The created thread need not be an ivykis thread. Enabling debugging by calling iv_thread_set_debug with a nonzero argument will print a debug message to standard error whenever a thread is created via iv_thread_create, whenever a thread so created terminates normally by returning from its start_routine, self-terminates by calling pthread_exit(3), or is successfully canceled by pthread_cancel(3), and whenever destruction of such a thread is signaled back to the calling thread. For inter-thread signaling, iv_thread uses iv_event(3). SEE ALSO
ivykis(3), iv_event(3), exit(3), pthread_cancel(3), pthread_create(3), pthread_exit(3) ivykis 2010-09-13 iv_thread(3)
All times are GMT -4. The time now is 09:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy