[fpc-pascal] Sched_Yield, TThread, Multiplexing, Sysutils, Sleep, Win32, Linux, and Thanks

Jason P Sage jasonpsage at jegas.org
Tue Sep 19 15:28:16 CEST 2006


First of all, I just had an altercation with my outlook - so I I'm a bit
disorganized now - ugh - But I wanted to thank Mark who suggested the Linux
fpNanoSecond function and the feedback from Micha.

 

Additionally, the suggestion to help the Free Pascal Team on things like the
Smart Linker - I consider it an honor - even if it was in jest. I'm such a
die-hard fan of FreePascal. I spend hours, days, months at a time - totally
immersed in it. A Master? Hardly! 

 

In my last email couple emails - I first posted to ask for help - for
something like the Win32 Sleep in linux -  which I was told about the sleep
function now being implemented in Linux sysutils - but - I was looking for
something more along the lines of the operating system's sched_yield
function in linux - Why? The size of SysUtils add a big amount of heft to my
applications in Linux and in Win32. 

 

I explained how one application I'm doing - needs a small foot print and
needs to be able to yield, and how in other stuff I'm doing - size doesn't
matter. (This is where the recommendation to help the FPC team on with
smart-linking on Linux came in with a smile. and in response - I'm swamped
but am planning on "giving back" .. I have honorable mention of FreePascal,
Lazarus, and MySql on my "not ready yet - no time) .org site: www.jegas.org
<http://www.jegas.org/>   By the way, I'm not the worlds best web gfx guy -
but that web site is totally freepascal. Each page - it firing FreePascal
Code in Linux AN was/is developed in Win32.

 

I was Talking a a bit about how I'm experimenting with TThread, and how I
basically have a "Windows OS" or Lazarus Application structure - in that it
has a messaging system like windows GetMessage and DispatchMessage, and how
all my classes have a similar base architecture that makes them really work
together versus fighting with them all the time.

 

I have basically made a working multiplexer and that is why TThreads has
caught my attention. Everything I'm doing runs in Linux and Windows - and if
it doesn't - its on my long to-do list. This multiplexer that has a console
GUI that is totally homegrown and has its own look - but is not far off from
FreeVision or Dos Edit's console windows except I wrote it from scratch
using the CRT, Mouse, video, and Keyboard units that come with FreePascal
This GUI is built on a wrapper I made for thiese console units called simply
CONSOLE. 

 

I have experimented with TThread, and I have found that in my code anyway -
it seemed to run in a serial fashion and not as a separate task. I forgot
what led me to believe this - most like a log file that recorded stuff by
simply appending a text file - and using the output to tell me what cam
first. but I digress. The truth is, I don't have an intelligent reason to
tell Micha about - because I don't remember - more importantly - its was
probably something in my code. Lets not forget I said I was just starting to
play with it. That means I'm definitely just learning - so TThread is
probably just fine - and its me.

 

It does seem appropriate to me that multi-threading is something I
definitely will want in my system - but I also very much believe that well
designed multiplexing systems can out perform threaded systems - in many
cases. Multiplexing: Need main loop that efficiently handles and delegates
work in small pieces, more or less emulated "multi-tasking" without overhead
of creating and swapping threads tasks in and out. This requires a
discipline from the "hello world" to the system roll out that intense if you
want to keep things running smoothly and not let the miles of source code
run away from ya.

 

Threading is great for many reasons - like parallel stuff, fire and forget
stuff, "Here Kid go ask that server for some data. let me know when you have
it" . so the flexibility of threading - and the scaleability - make it
really awesome.

 

I'm still learning - always learning - but as I'm moving toward this
threading business - I keep finding a certain amount of validation for the
multiplexer architecture - in that only through it - does it SEEM to me that
I can do a logical approach to handling/managing the threads. By maintaining
them in the main loop of main app, house cleaning - commandeering them  to
suspend, resume, or whatever as necessary - I really (as a parent my self)
think of the multiplexer as the parent process, and the threads - children -
that - yes they can do what they want - but only under supervision :-)

 

I'm not a good writer ro anything but I wanted to address the matters people
wrote to me about in response to my earlier emails. I've tried to cover a
lot of ground - and I hear my favorite text editor sitting idle - Time to do
some programming!

 

Jason P Sage

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20060919/76eeddde/attachment.html>


More information about the fpc-pascal mailing list