1. Multitasking vs. multithreading

Seems I am having trouble here...I've got some code for multitasking in
the Pascal environment, and I'm thinking of implementing this simple
multitasking in a game I am developing.  I remember months back
searching Dejanews that someone had suggested multithreading for a
multiuser game.  After many searches on inet, I've been unable to find
any decent multithreading examples.  Just what is the difference between
multitasking and multithreading.  And, I do believe the tasking is
easily done in Euphoria, but what about the threading?

Thanks!!
Kevin

new topic     » topic index » view message » categorize

2. Re: Multitasking vs. multithreading

Kevin Sieger wrote:
>
> Seems I am having trouble here...I've got some code for multitasking in
> the Pascal environment, and I'm thinking of implementing this simple
> multitasking in a game I am developing.  I remember months back
> searching Dejanews that someone had suggested multithreading for a
> multiuser game.  After many searches on inet, I've been unable to find
> any decent multithreading examples.  Just what is the difference between
> multitasking and multithreading.  And, I do believe the tasking is
> easily done in Euphoria, but what about the threading?
>
> Thanks!!
> Kevin

I'm no expert on this, as yet I've never written anything using
multithreading. My understanding of the difference between the two
is this; multitasking simply refers to running two seperate programs
concurrently, multithreading is used to run two processes within the
same program concurrently. Multithreading simply isn't possible under
Dos. I think I remember reading the old doshell program "emulated"
multitasking of programs ran in it, but by some definition it was
regarded as not being "true" multitasking.
The win95 system offers both. Multitasking takes place all the time as
you run two programs at the same time. Multithreading is set up through
calls to the kernel32.dll interface. I also understand it to be that
multithreading does not increase the speed of your programs unless
you are running on a multi-processor machine (might actually be slower).
It just makes the program capable of carrying on other processes while
still interacting with the user.

Christopher D. Hickman

new topic     » goto parent     » topic index » view message » categorize

3. Re: Multitasking vs. multithreading

MAP wrote:

> Kevin Sieger wrote:
> >
> > Seems I am having trouble here...I've got some code for multitasking in
> > the Pascal environment, and I'm thinking of implementing this simple
> > multitasking in a game I am developing.  I remember months back
> > searching Dejanews that someone had suggested multithreading for a
> > multiuser game.  After many searches on inet, I've been unable to find
> > any decent multithreading examples.  Just what is the difference between
> > multitasking and multithreading.  And, I do believe the tasking is
> > easily done in Euphoria, but what about the threading?
> >
> > Thanks!!
> > Kevin
>
> I'm no expert on this, as yet I've never written anything using
> multithreading. My understanding of the difference between the two
> is this; multitasking simply refers to running two seperate programs
> concurrently, multithreading is used to run two processes within the
> same program concurrently. Multithreading simply isn't possible under
> Dos. I think I remember reading the old doshell program "emulated"
> multitasking of programs ran in it, but by some definition it was
> regarded as not being "true" multitasking.
> The win95 system offers both. Multitasking takes place all the time as
> you run two programs at the same time. Multithreading is set up through
> calls to the kernel32.dll interface. I also understand it to be that
> multithreading does not increase the speed of your programs unless
> you are running on a multi-processor machine (might actually be slower).
> It just makes the program capable of carrying on other processes while
> still interacting with the user.
>
> Christopher D. Hickman

  Hmm, it seems there is a term conflict here, not necessarily yours.  The
units which I have implement a simple multitasking within a pascal program,
i.e. instead of one or more programs running concurrently, it will allow
different procedures, functions etc. assigned as tasks, to run inside of the
same program.  The unit is non-preemtive (OS/2, Linux, and WinNT being
preemptive), but is more of a ccoperative multitasking.  It is hard to
explain, but according to your definition, this would be multiTHREADING.
Anyways, I believe this unit to be easily coded into Euphoria.

BTW, the unit is for TP6+, so the target system would be DOS.

Thanks!!
Kevin

new topic     » goto parent     » topic index » view message » categorize

4. Re: Multitasking vs. multithreading

-----Original Message-----
From: Kevin Sieger <simkin at ZEBRA.NET>
To: Multiple recipients of list EUPHORIA <EUPHORIA at MIAMIU.ACS.MUOHIO.EDU>
Date: Wednesday, March 04, 1998 6:09 PM
Subject: Re: Multitasking vs. multithreading


>MAP wrote:
>
>> Kevin Sieger wrote:
>> >
>> > Seems I am having trouble here...I've got some code for multitasking=
 in
>> > the Pascal environment, and I'm thinking of implementing this simple
>> > multitasking in a game I am developing.  I remember months back
>> > searching Dejanews that someone had suggested multithreading for a
>> > multiuser game.  After many searches on inet, I've been unable to fi=
nd
>> > any decent multithreading examples.  Just what is the difference
between
>> > multitasking and multithreading.  And, I do believe the tasking is
>> > easily done in Euphoria, but what about the threading?
>> >
>> > Thanks!!
>> > Kevin
>>
>> I'm no expert on this, as yet I've never written anything using
>> multithreading. My understanding of the difference between the two
>> is this; multitasking simply refers to running two seperate programs
>> concurrently, multithreading is used to run two processes within the
>> same program concurrently. Multithreading simply isn't possible under
>> Dos. I think I remember reading the old doshell program "emulated"
>> multitasking of programs ran in it, but by some definition it was
>> regarded as not being "true" multitasking.
>> The win95 system offers both. Multitasking takes place all the time as
>> you run two programs at the same time. Multithreading is set up throug=
h
>> calls to the kernel32.dll interface. I also understand it to be that
>> multithreading does not increase the speed of your programs unless
>> you are running on a multi-processor machine (might actually be slower=
).
>> It just makes the program capable of carrying on other processes while
>> still interacting with the user.
>>
>> Christopher D. Hickman
>
>  Hmm, it seems there is a term conflict here, not necessarily yours.  T=
he
>units which I have implement a simple multitasking within a pascal progr=
am,
>i.e. instead of one or more programs running concurrently, it will allow
>different procedures, functions etc. assigned as tasks, to run inside of
the
>same program.  The unit is non-preemtive (OS/2, Linux, and WinNT being
>preemptive), but is more of a ccoperative multitasking.  It is hard to
>explain, but according to your definition, this would be multiTHREADING.
>Anyways, I believe this unit to be easily coded into Euphoria.
>
>BTW, the unit is for TP6+, so the target system would be DOS.
>
>Thanks!!
>Kevin

Here is an clip from the Win95 resource kit I think that it will clearup =
the
difference between MultiTasking and MultiThreading.  Seek out the resourc=
e
kit for more info on this subject.


---------------------- Begin
Clip --------------------------------------------
The Process Scheduler is the component responsible for providing system
resources to the applications and other processes you run, and for
scheduling processes to allow multiple applications to run concurrently.
The Process Scheduler also schedules processes in a way that allows multi=
ple
applications and other processes to run concurrently. Windows 95 uses two
methods for concurrent process scheduling =97 cooperative multitasking an=
d
preemptive multitasking.
With Windows 3.1, applications ran concurrently through a method known as
cooperative multitasking. Using this method, the operating system require=
d
an application to check the message queue periodically and to relinquish
control of the system to other running applications. Applications that di=
d
not check the message queue frequently would effectively =93hog=94 CPU ti=
me and
prevent the user from switching to another application. For compatibility
reasons, Windows 95 cooperatively multitasks Win16-based applications.

Windows 95 uses preemptive multitasking for Win32-based applications. Thi=
s
means that the operating system takes control away from or gives control =
to
another running task, depending on the needs of the system.
Unlike Win16-based applications, Win32-based applications do not need to
yield to other running tasks to multitask properly. Win32-based applicati=
ons
can take advantage of multithreading, a mechanism that Windows 95 provide=
s
to facilitate the ability to run applications concurrently. A Win32-based
application running in the system is called a process in terms of the
operating system. Each process consists of at least a single thread of
execution that identifies the code path flow as it is run by the operatin=
g
system. A thread is a unit of code that can get a time slice from the
operating system to run concurrently with other units of code, and must b=
e
associated with a process. However, a Win32-based application can initiat=
e
multiple threads for a given process to enhance the application for the u=
ser
by improving throughput, enhancing responsiveness, and aiding background
processing. Because of the preemptive multitasking nature of Windows 95,
threads of execution allow code to be smoothly processed in the backgroun=
d.

A good illustration of this is the Windows 95 shell itself. Although the
shell is a Win32-based process, each folder window that opens is a separa=
te
thread of execution. As a result, when you initiate a copy operation betw=
een
two shell folder windows, the operation is performed on the thread of the
target window. You can still use the other windows in the shell without
interruption, or you can start a different copy in another window.
In another example, a word processing application (a process) can impleme=
nt
multiple threads to enhance operation and simplify interaction with the
user. The application can have a separate thread that responds to keys ty=
ped
on the keyboard by the user to place characters in a document, while anot=
her
thread performs back-ground operations such as spelling checking or
paginating, and while a third thread spools a document to the printer in =
the
background.

Note  Some Win16-based applications may have provided functionality simil=
ar
to this; however, because Windows 3.1 didn=92t provide a mechanism for
supporting multithreaded applications, it was up to application vendors t=
o
implement their own threading schemes. The use of threads in Windows 95
makes it easy for application vendors to add asynchronous processing of
information to their applications.

---------------- End Clip ------------------------------------------

new topic     » goto parent     » topic index » view message » categorize

5. Re: Multitasking vs. multithreading

This is a thread started 12 years ago......

Since multithreading and multitasking were asked for 12 years ago (and prolly well before that), is there anyone still here (besides me and jiri) to use multitasking now that we got it?

I kind of expected the games people to be all over this, since it would allow every user in MUD/MUSH to be a task, with the world being the parent. Or anyone running busy code that still had to watch for user input.

No one?

useless
(was "Kat" back then)

new topic     » goto parent     » topic index » view message » categorize

6. Re: Multitasking vs. multithreading

Kat said...

I kind of expected the games people to be all over this, since it would allow every user in MUD/MUSH to be a task, with the world being the parent.

Ok, I admit that I'm working on a game engine that will require multitasking.

Actually, it will be for a new contest for when v4 is generally available. The contest details have yet to be worked out but the engine is going well. The contest will require contestants to write a bot program that will build and control a navy fleet and it will compete against other bots for domination over a set of supplied maps.

new topic     » goto parent     » topic index » view message » categorize

7. Re: Multitasking vs. multithreading

Hmmm... me thinks multitasking + pipe I/O might make for a stable video transcoding queue system... I'll see what I can work out. grin

-Greg

new topic     » goto parent     » topic index » view message » categorize

8. Re: Multitasking vs. multithreading

ghaberek said...

Hmmm... me thinks multitasking + pipe I/O might make for a stable video transcoding queue system... I'll see what I can work out. grin

You know we do have cross-platform pipes I'm sure?

Jeremy

new topic     » goto parent     » topic index » view message » categorize

9. Re: Multitasking vs. multithreading

ghaberek said...

Hmmm... me thinks multitasking + pipe I/O might make for a stable video transcoding queue system... I'll see what I can work out. grin

-Greg

You have not seen the task.e msg passing code yet? Or will pipes be better in some way?

useless

new topic     » goto parent     » topic index » view message » categorize

10. Re: Multitasking vs. multithreading

useless said...

You have not seen the task.e msg passing code yet? Or will pipes be better in some way?

useless

I use external programs like vobcopy, ffmpeg and HandBrake. I need pipe I/O to launch and monitor those programs. I also two- or three-step these processes, such as ripping DVDs raw, encoding them later, and possibly post-processing them. It would be really nice to have a tasking service that:

  1. watched the DVD drive(s) for a new disc
  2. started ripping a disc when it was inserted
  3. passed the ripped disc onto an encoding queue
  4. encoded 2-4 discs at once


So the message-passing features will certainly help, as I can pass "here, encode this" from the ripping task to the encoding task. I'll also be using the newer database features so I can keep this all in a MySQL database, then write a PHP front-end to manage the service. grin

jeremy said...

You know we do have cross-platform pipes I'm sure?

Yes! That's why I'd like to do it this way. All the other tools I use are cross-platform, so it would be nice to make this whole thing cross-platform without much hassle.

-Greg

new topic     » goto parent     » topic index » view message » categorize

11. Re: Multitasking vs. multithreading

ghaberek said...

then write a PHP front-end to manage the service. grin

I was with you until this! Use Euhporia, maybe w/WebClay! It's actually much easier to create web apps in WebClay than PHP, IMHO smile

Jeremy

new topic     » goto parent     » topic index » view message » categorize

12. Re: Multitasking vs. multithreading

jeremy said...

I was with you until this! Use Euhporia, maybe w/WebClay! It's actually much easier to create web apps in WebClay than PHP, IMHO smile

Heh. I figured you'd chime in about that. Euphoria and WebClay aren't my cup of tea, really. PHP fits me like a well-worn pair of jeans. PHP, MySQL, Smarty, and jQuery are my best friends in web development. blink

I have no plans to use Euphoria for web development anytime in the near future. Conversely, I have no plans to use PHP for writing command line and/or GUI programs. Each is a tool with a designated purpose, IMHO, and I hate it when people turn screws with butter knives. tongue

-Greg

new topic     » goto parent     » topic index » view message » categorize

13. Re: Multitasking vs. multithreading

ghaberek said...

Heh. I figured you'd chime in about that. Euphoria and WebClay aren't my cup of tea, really. PHP fits me like a well-worn pair of jeans. PHP, MySQL, Smarty, and jQuery are my best friends in web development. blink

I don't know about JQuery, but Euphoria, MySQL and Kanarie are the same stack but a better setup.

Jeremy

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu