473,395 Members | 1,774 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

plzz help, give me d solution..

Problem 2: Threading:



Requirements: In a particular system there are two threads T1 and T2.

T1 is the master thread that periodically sends messages to the worker thread T2.

The system is time-critical and hence T2 must react to every message that T1 sends.

None of the messages must be lost.T2 performs time consuming operations like

mixing sound samples and sending them to the sound buffer.



Here is the hypothetical POSIX like library that is available to

synchronize the threads:



Mutex locking and unlocking are done through to the calls

int lock(Mutex_t* mutex);

int unlock(Mutex_t* mutex);



Thread messaging is done through condition variables that operate

with an associated mutex.



A thread that responds to a message needs to wait on a condition variable.

It should own the associated mutex prior to entering the wait state.

When it enters the wait state, it simultaneously releases the ownership

of the mutex. Upon return from the wait state, it owns the mutex.

int wait(Condition_t* condition, Mutex_t* mutex);



A thread that sends message to another thread needs to signal the condition

variable. In order to signal the condition variable, the thread must own the

associated mutex.If no thread is waiting on the condition variable, the `signal'

or message is lost. If a thread is waiting on the condition variable, then it resumes

execution.

int signal(Condition_t* condition, Mutex_t* mutex);



Task: You can write this in C# or C++ syntax or pseudo code. The idea is to come up with the best and most efficient algorithm that would address the requirements.
Oct 17 '06 #1
1 1597
tyreld
144 100+
Interesting problem. Have you tried to solve it yourself? You will be more likely to get a response if you try to solve this and then post particular questions about specific things you are stuck on or having problems with.
Oct 17 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: blah | last post by:
Need python Pro at newtopython@googlegroups.com , if u wanna help, plz reply to that address. We are python beginners. need a real good Python Programmer for Help. TIA!! -- * Posted with...
14
by: alwayshouston | last post by:
Hi All! I am working on this very small database and I am confused in the designing a simple form. I only have three tables in the database. First Table: tblExpense Columns: ExpenseID ;...
1
by: aj | last post by:
plzz help me to add How a Blank row in a datagrid without using dataset or any other. plzzz help me
1
by: Robin Patra | last post by:
Hi , I am getting the following error when i moved my application from one machine to other.. Visual Studio .NET cannot create or open the application. The likeliest problem is that required...
40
by: dev_cool | last post by:
hello everybody, i'm a new member of this group, this is my first ever post. i've found a c program that prints prime numbers through an infinite loop. But I really don't understand the code....
5
by: irin07 | last post by:
hello... i just learn how to use php,can anyone help me about how to edit database using php,plzz....i need urgently and i really blank about this. this the database dbhelpdesk table...
1
by: sunil | last post by:
Hi, I want to change the default installation folder to my own path. I did it by changing the application folder's DefaultLocation property. The installation works fine as long the path that I...
1
by: sid1761983 | last post by:
Plz check error in line no. 13.here give me error that Error :- Run Time Error : '424' Object required plz check it these code wriiten in visual basic6.0 plz anyone...
0
by: gruntday | last post by:
hey guys can any one help me or give me any detailed idea on how to do this: i want to make an application with visual basic 6 to open an existing .ppt file and edit the values of each msgraph in...
3
by: ABOD | last post by:
hi all...plzz..help me to solve this Q. write a multithreading program to multiply ttwo matrices M and N. The two matrices may have differnrt size. M is (r*w) and N is(w*z) The result is a r*z...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.