Sponsored Content
Top Forums Programming Asynchronous communication between master and slave threads Post 302807463 by tamil.pamaran on Tuesday 14th of May 2013 05:47:42 PM
Old 05-14-2013
Asynchronous communication between master and slave threads

I am writing a process that has a master thread and a set of slave threads. Master thread is supposed to get jobs dynamically and assign to slave thread which is free. Master also get results back from slaves once a job is done. The number of slaves should be adjustable dynamically based on job load.

The interesting thing is that when job is in progress, master may decide to stop a job. I am thinking of some way of communication between one(master) and many(slaves) to assign jobs, stop a job (specific to a salve which does the job), get results from slave.

Will message queues be useful?

Thanks in advance

/Tamil
 

8 More Discussions You Might Find Interesting

1. Programming

asynchronous control of threads

I am attempting to build a library that is transparent to the client code. A shared resource is used by many threads with their own synchronization code, but every once in a while, ALL threads need to be stopped for some background control thread to update this resource before proceeding. I have... (2 Replies)
Discussion started by: Corona688
2 Replies

2. UNIX for Advanced & Expert Users

NIS master / slave problems

Our NIS master server went down. We have since fixed it and brought it back up. However all of are machines still point to the slave server when looking at it with ypwhich. My question is how do i point the servers back to the master. Frank (2 Replies)
Discussion started by: frankkahle
2 Replies

3. SCO

master and slave in lan network

hello , i setup a lan network , but i don't know how configure master and slave in the lan network please help me:confused: (2 Replies)
Discussion started by: hossein
2 Replies

4. Web Development

MySQL Master-Slave Configuration: Don't Replicate a Row of a Table?

Anyone have a clue about this? I have checked the MySQL documentation and it does not seem possible to exclude a row of a table from replication between Master and Slave. It seems that replication in MySQL can only be managed at the table level, not at the row level. Does anyone know a work... (5 Replies)
Discussion started by: Neo
5 Replies

5. UNIX Desktop Questions & Answers

How can I replicate master master and master master MySQL databse replication and HA?

I have an application desigend in PHP and MySQl running on apache web server that I is running on a Amazon EC2 server Centos. I want to implement the master-master and master slave replication and high availability disaster recovery on this application database. For this I have created two... (0 Replies)
Discussion started by: Palak Sharma
0 Replies

6. AIX

Problem in communication nim client with nim master

Hello, I have an AIX6.1 machine which is a nim client to my nim master which is also AIX6.1 machine. I had some problem to perform an installation on my client using smit nim . i removed /etc/niminfo file in order to do the initialization again but when i run the command niminit -a name=client... (0 Replies)
Discussion started by: omonoiatis9
0 Replies

7. Programming

How to wait the slave to be finished first then execute the master--MPI C++?

Hi, How to wait the slave to be finished first then execute the master? Can someone give me the specific function? Or the detailed example. Thanks~ (1 Reply)
Discussion started by: wanliushao
1 Replies

8. IP Networking

DNS question about initial Master/Slave setup

Hey everyone. I'm creating a DNS master/slave server set up. I have the configurations all done I believe, the master has the required zone file, and the named.conf file has the allow transfer and allow query stuff set. The slave has it's own configs set. My question is that when initially... (1 Reply)
Discussion started by: Lost in Cyberia
1 Replies
pts(7)							 Miscellaneous Information Manual						    pts(7)

NAME
pts - STREAMS slave pty (pseudo-terminal) driver SYNOPSIS
DESCRIPTION
A pseudo-terminal (pty) consists of a tightly-coupled pair of character devices, called the master device and slave device. The pty master and slave device drivers work together to simulate a terminal connection where the master provides a connection to the pseudo terminal server process and the slave provides a terminal device special file access for the terminal application processes, as depicted below: ---------------- | pty functions | Application <--> |----------------| <--> Server Processes | Slave | Master | Process | (pts) | (ptm) | ---------------- The slave driver, with (STREAMS pty emulation module) and (STREAMS line discipline module) pushed on top (not shown for simplicity), pro- vides a terminal interface as described in termio(7). Whereas devices that provide the terminal interface described in termio(7) have a hardware device behind them; in contrast, the slave device has another process manipulating it through the master side of the pty. Data written on the master device is given to the slave device as input and data written on the slave device is presented as input on the master device. In order to use the STREAMS pty subsystem, a node for the master pty driver and N number of slave pty devices must be installed (see ptm(7) for more details on master pty). When the master device is opened, the corresponding slave device is automatically locked out. No user can open that slave device until its permissions are changed (via the function) and the device is unlocked (via the function). The user then call the function to obtain the name of the slave device and invoke the system call to open the slave device. Although only one open is allowed on a master device, multiple opens are allowed on the slave device. After both the master and slave have been opened, the user has two file descriptors which represent the end points of a full duplex connection composed of two streams that are automatically con- nected by the master and slave devices when they are opened. The user may then push the desired modules (for example, and on for terminal semantics and on for Packet Mode feature). The master and slave drivers pass all STREAMS messages to their adjacent drivers. Only the message needs some special processing because the read queue of the master is connected to the write queue of the slave and vice versa. For example, the flag is changed to flag and vice versa whenever a message travels across the master-slave link. When the master device is closed, an message is sent to the corre- sponding slave device which will render that slave device unusable. The process on the slave side gets the errno when attempting a system call to the slave device file but it will be able to read any data remaining in the slave stream. Finally, when all the data has been read, the system call will return 0, indicating that the slave can no longer be used. On the last close of the slave device, a zero-length message is sent to the corresponding master device. When the application on the master side issues a read(2) or getmsg(2) system calls, a 0 (zero) is returned. The user of the master device may decide to close the master device file, which dismantles the stream on the master side. If the master device remains opened, the corresponding slave device can be opened and used again by another user. EXAMPLES
The following example shows how a STREAMS pty master and slave devices are typically opened. AUTHOR
was developed by HP and OSF. FILES
Streams pty master clone device Streams pty slave devices (0 <= N < where is a kernel tunable parameter which can be changed via SAM (see sam(1M)). SEE ALSO
insf(1M), sam(1M), getmsg(2), ioctl(2), open(2), read(2), write(2), grantpt(3C), ptsname(3C), unlockpt(3C), ldterm(7), ptem(7), ptm(7), streamio(7), termio(7). pts(7)
All times are GMT -4. The time now is 02:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy