News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Using fibers...

Started by Danesh, March 11, 2005, 10:03:43 PM

Previous topic - Next topic

Danesh

Hi all,

Here with MASM32 package, many good tutorials exist. For example about threads and processes and multitasking issues, here are some great examples (icztutes), but about working with Fibers such as creating fibers, managing fibers and... there is no example. Can anybody help to find samples or tutorials about fibers ?

Thanks,

Danesh




James Ladd

Danesh,
Fibers (sometimes called green threads) are user managed and created threading. So you implement this yourself.
For example you would create a thread and have it slice its time between several tasks. Thus prividing flow
and processing within a thread. ie: If you split a cotton thread, you get fibers.
This has also been called "Cooperative threading" in the past.

Its not an API level thing supported by the Win32 platform.

There are a lot of good sources on the net about implementing threading and one of these should help you.

Why do you need to get to this level ?

Danesh

Striker,

Thanks for information. As you know (you helped me in socket programming) I was working on a server program which had to create and manage threads. I was thinking about creating fiber in one thread instead of creating threads in threads. I think by creating fibers instead of threads overheads may decrease and the whole program would run in an more efficient way. Also, I think working with fibers is an API level supported thing because in API list there are some functions about working with fibers but maybe I am wrong. For example, here is CreateFiber API function's link:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/createfiber.asp

Regards,

Danesh


James Ladd

Danesh,
Ah, so there is an api for fibers. Kewl.
You will still have to work out a way to schedule them. ie: When to call switchTo.
This could be done with events on the IO completion of other things.
Personally I would wait for my framework to be finished as its not that far away ;)
If you want to continue with fibers then read about cooperative multitasking as
a way to schedule the fibers.
Rgs, striker

Danesh

Striker,

Thanks. I will research more about multitasking and fibers. By the way, I believe that FastServer is GREAT and I REALLY LOVE IT. Of course I will use it. This server program is something else which will be substituted by FastServer.  :U



James Ladd

Danesh,
Thanks. I will try and complete FAStServer as quick as I can so you can use it to its full potential.
Rgs, striker.