|
|
I am not going to give you an answer, because you did no give an explanation of what fork() does. You have received a couple of answers about generating a child process.
What do you want to know precisely?
INTP
Every thing is relative...
|
|
|
|
|
I'm not a linux expert but I think fork() creates a new thread and not a new process. Am I right (not sure at all about that). The previous answers you get was how to create a process (so run another executable). If you want to run a thread in parallel, then you have to look for CreateThread[^]
|
|
|
|
|
fork() creates a new process - an exact duplicate of the current process, including the current code location. You can do this:
switch(fork())
{
case 0:
exit(0);
default:
break;
}
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Here is the discription of fork() function.
"fork creates a child process that differs from the parent process only in its PID and PPID, and in the fact that resource utilizations are set to 0."
I wanted to do the same thing in win32. I do not want operating system to allocate saperate resourses to new process. Infact i want the process to share the same resourses that it's parent is using. Are you getting my point?
Thank you.
We Believe in Excellence
|
|
|
|
|
Look at CreateThread() . It's exactly what you're after. But read up on multithreading, because you obviously don't know a lot about it. It can be quite tricky to learn...
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
There is no fork equivalent under Windows. I suggest you consider using threads rather than processes - that is the Windows way of handling concurrency.
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
Nemanja Trifunovic wrote: I suggest you consider using threads rather than processes - that is the Windows way of handling concurrency.
Actually, its becoming more and more the Linux way of concurrency.
NPTL is a stable working thread implementation.
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
how would i go about that
martin reagan akula
|
|
|
|
|
|
your cyber cafe must have a VoIP client ( whtever the real name is ).
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Hi,
I want to do calcualtions on different datafile parallely, that is if i do on them sequencialy then Let say if it take one munite to perform calcualtion on file then it will take 60 minutes to perfeorm calculation on 60 files.
but i want that the calcualtion should be done in parllal so that i can reduce the calcualtion time on 60 files.
Any Idea?
I have a Uni processor machine
I hope you undesrtand my point
thanks
Regards.
|
|
|
|
|
Make a new calculation in a new thread. But you will need to read some documentation on, take a look at the MSDN (for CreateThread) or on this website.
But this won't reduce the total time because if you are running 60 threads in parallel (don't even know if this is possible), each thread will have less CPU time for its own so it will run slower thus it will take more time to finish. I don't think this is a good solution.
|
|
|
|
|
I do not know the answer, but I think there may be an article at CP some where. Depending on the operating system, compiler, and how you wrote the code it may already be doing what you want. Before asking the question you need to determine if both processors are handling the problem. Then you need to fuigure out how to hand off individule problems to each processor.
I know it does sound simple but it is not [realy].
INTP
Every thing is relative...
|
|
|
|
|
AFAIK, you wont be able to do this on a single CPU computer.
me think that in the best case scenario, you will have the same time, but in some other cases, it will take more time because of context switching between threads.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
After each file's contents have been read into a separate (heap) buffer, call AfxBeginThread() , passing it the address of the buffer. As each thread completes its processing, it will free the heap memory.
Since some of the earlier threads will have completed by the time the later ones are created, you probably won't have 60 threads in existance at one time.
Make sense?
Assuming you get this working, it would be to your benefit to benchmark it against your initial design using sequential processing. I would be surprised if the additional overhead of extra threads was of any real benefit.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
how i can access to memory loaded
am
|
|
|
|
|
Be more specific.
INTP
Every thing is relative...
|
|
|
|
|
|
If you want to know what has been loaded into memory, then it depends on the Operating System. If it is NT-based, Windows will hardly let you read anything other than your own variables and program code. It can be done but difficult. You can check for the readable and/or writable memory using some API functions like:
BOOL IsBadReadPtr(const VOID* lp, UINT_PTR ucb);<br />
BOOL IsBadWritePtr(LPVOID lp, UINT_PTR ucb);
If you really want to get to the core, then use MS-DOS. It will let you do anything you want.
Like:
unsigned far char* p = 0;<br />
p++;<br />
...<br />
...
[Edit]Correction:
I wrote unsigned far char* as unsigned long char* Heh.[/Edit]
this is this.
-- modified at 6:37 Wednesday 1st March, 2006
|
|
|
|
|
Hi!
I want know around Anti-Debugger Codes.
please help me!
Zo.Naderi-Iran
|
|
|
|
|
Before someone can answer this question, we need to know what "Anti-Debugger Codes" mesans!
INTP
Every thing is relative...
|
|
|
|
|
|
hello all
how to place bitmaps over the buttons using the property Setbitmap and getbitmap in vc++.
Thanks in advance
cheers
ramya
|
|
|
|
|
Declare a CBitmapButton control variable for the button and call the LoadBitmaps() method.
Set the OWNERDRAW property for the button.
Vini
|
|
|
|