473,396 Members | 2,139 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,396 software developers and data experts.

more task related questions..

Come to think of it I have another question:

With respect to priority task1 is the highest, task2 is the lowest. The
snippet:

SEM_ID task1_sema = semBCreate(SEM_Q_FIFO, SEM_EMPTY);
SEM_ID task2_sema = semBCreate(SEM_Q_FIFO, SEM_EMPTY);

void compute_like_crazy()
{
}
void give_t1_sema() { semGive(task1_sema); }

void give_t2_sema() { semGive(task2_sema); }

void give_both_sema() {
semGive(task1_sema);
semGive(task2_sema);
}

void task1()
{
while (1)
{
if (semTake(task1_sema, WAIT_FOREVER) != OK)
continue;
std::cout << " task one started " << endl;

for (int idx(0); idx < 10000; ++idx)
{
compute_like_crazy();
taskDelay(sysClkRateGet() * 1);
}
std::cout << " hi there from task one " << endl;
}
}
void task2()
{
while (1)
{
if (semTake(task2_sema, WAIT_FOREVER) != OK)
continue;
std::cout << " task two started " << endl;

std::cout << " hi there from task two " << endl;
}
}

I was surpised to learn that if I typed give_both_sema at the console
prompt.
The result prints:
task one started
task two started
hi there from task two
hi there from task one

The reason for my suprise surrounds the fact that I was of the
impression that the _highest_ priority task - in this case - task1
(which executed first) is in control of the CPU. That said, task2 will
literally have to 'wait' until task1 is complete before executing. The
results show otherwise. 'hi there from task two' prints before 'high
there from task one'. Does this mean task2 suspends 'task1' or .. what
am I missing. Not sure how two task could execute at the same time?

Being new to vxWorks I suspect it's time to pull out the manual again
since I'm not sure my understanding of high and lower prority tasks are
in synch with the output.

Oct 25 '05 #1
1 1811
Sorry guys. I realize I goof. Picked the wrong group.
My apologies.

Oct 25 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Mike | last post by:
Task Center application on Win2k3 is slooooowww. Whenever I make a change or update to something in task center it takes 5 minutes to apply the changes or bring it up. It seems to lose focus on the...
7
by: Russ via AccessMonster.com | last post by:
Can someone tell me how to change the icon in the windows task bar? I already figured out how to do it in the forms, and shortcuts but the windows task bar still says Microsoft Access, I only want...
1
by: KBuser | last post by:
Preface: I'm building an intranet site to build custom queries against our SQL Server (2000) db; The page is developed in ASP.net (2.0) with C# Codebehind. I dynamically generate and populate...
0
by: orit | last post by:
Again, I have the following xml code: <?xml version="1.0" ?> <course> <globalProperties> <externalMetadata> <source>ADL</source> <model>ADL SCORM 1.0</model> </externalMetadata>...
1
by: Myster Edd | last post by:
I have a strange problem that I think deals with security on SQL 2005. I have a scheduled task that runs on a Windows 2000 machine. It calls a vb script which creates a connection to SQL Server. ...
0
by: boomertoo55 | last post by:
Trying to exec DTS task involving load of MS Access table to SQL Server 2000 table using Data Pump task via remote exec of xp_cmdshell command of dtsrun. That is, on client, connect to database...
1
by: vinudaya | last post by:
Hi, This is vinu I have craeted a simple database. But i i want to relate them. ex:- at our office 8 engineers r there. they r having specific task nos. Ex :- Say ramesh is having 8 task nos....
23
by: sophia.agnes | last post by:
Dear all, I was going through a C book written by an indian author the following are the questions given in that book 1) consider the following statement: s1 : an operator may require an...
1
by: Andy B | last post by:
I have several tasks that my web applications need to do. They are managing membership, News, Events, Legal forms for admin, Legal forms for customers, audio and maybe a few other things here and...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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.