Lost Password?


Go Back   CodeCall Programming Forum > Software Development > C and C++

C and C++ C and C++ forum for discussing all forms of C except for C#. These languages are powerful low level languages used for creating Operating Systems, Device Drivers, compilers and much more.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-28-2007, 01:08 AM
Gordack Gordack is offline
Newbie
 
Join Date: Apr 2007
Posts: 4
Rep Power: 0
Gordack is on a distinguished road
Default Need help with "a multi-threaded program using POSIX thread library"

Guys, sorry i couldnt write any code because i have no idea.
This is my homework and i must do it.
Can u say any tips or show example codes ?
In anyhelp , i will be glad. Thanks.

The program has three threads. All threads share an array A of n integers, where n is a command line parameter.
The main thread of the program initially fills the array with random integers in the range 1…n and creates two search threads.
The search threads run the same function

search(int A[], int size, char direction, int target)

The function searches half of the array for the target and prints the indices where it is found. Target is also a command line parameter.

A typical run of the program is as follows:

./a.out 12 4
thread 1: found 4 at index 0
thread 2: found 4 at index 10
thread 2: found 4 at index 8
thread 1: found 4 at index 5
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT -5. The time now is 03:04 AM.

Contest Stats

WingedPanther ........ 2753.6
Xav ........ 2704
Brandon W ........ 1702.32
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 966.05
dcs ........ 655.75
Steve.L ........ 475.59
orjan ........ 418.58
Aereshaa ........ 383.54

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 100%


Complete - Celebrate!

Ads