Sign in

username:

password:



Not a member?

Search basicx



Search tips

Subscribe to basicx



basicx by Keywords

Accelerometer | ADC | ADXL | Adxl20 | AVR | BasicStamp | BX-35 | BX28 | BX35 | COM3 | Compiler | Downloader | EEPROM | Electromagnet | GetADC | GP2D1 | GPS | I2C | IDE | Keypad | LCD | LCD+ | MIDI | Motors | Multitasking | Netmedia | Networking | PCB | PID | PlaySound | PWM | Relays | RTC | Servo | ShiftOut | SitePlayer | SPI | Stack | Timer | USB

Ads

Discussion Groups

Discussion Groups | BasicX | How does multitasking work?

Discussion forum for the BasicX family of microcontroller chips.

How does multitasking work? - Jack Wu - Jan 7 1:31:00 2003

How does multitasking work?
say here is my code:

Call PutByte(blah blah)
Call PutByte(blah blah)
Call PutByte(blah blah)
Call PutByte(blah blah)
Delay(0.1)
Call GetByte(blah blah)
Call GetByte(blah blah)
Call GetByte(blah blah)
Call GetByte(blah blah)
---------------------------------
besides a pause of 100ms, what multitasking happens here?

__________________________________________________






(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )


Re: How does multitasking work? - Frank Manning - Jan 7 12:37:00 2003

From: "Jack Wu" <>

> How does multitasking work?
> say here is my code:
[...]
> Call PutByte(blah blah)
> Delay(0.1)
> Call GetByte(blah blah)
[...]
> besides a pause of 100ms, what multitasking happens
> here?

It depends on what the rest of the program looks like. If there
are no CallTask statements in the program, then no multitasking
occurs.

If there are CallTask statements, and one or more additional tasks
have started by the time the delay is executed, then other tasks
may run during the delay, depending on whether they are eligible
to run.

By the way, task switching can occur even in the absence of calls
to delay. Task switching normally occurs at every tick of the real
time clock.

-- Frank Manning
-- NetMedia, Inc.




(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: How does multitasking work? - Mark Newell - Jan 7 15:29:00 2003

Jack,

The fundamentals of multitasking is to switch from processes that are waiting on an event to allow
other process that need cpu processing to run. There are several models of
multiprocessing(multiprocessing) available: (1) large mainframe systems that allow thousands of
users to use the same processor(s) as though they have a dedicated processor to them (a very large
time sharing system costing millions of dollars) ; (2) "realtime systems" that must process a
"real time event" at a specific time or the event is lost for ever. These "realtime systems" have
to be sized to ensure nothing is gone unprocessed(and usually over sized). An example might be a
system traveling through space that must make a turn at a point in space or be lost for ever.
This is not to be confused with on-line systems like airlines reseverations systems where if a
request processing is delayed a little the worst that is going to happen is a missed seat on a
particualar plane. Or if the response time is too long the customer gets upset and comes back
later. (3) the last type is a simple task switching switching that gives a programmer some power
over when tasks are given a chance to run. There are normally some basic operating systems
primitives built in that us as programmers some control how and when tasks are switched and many
times that have to be designed in a "cooperative" mode. I my humble opioion Netmedia has done a
very fine cost effective/function job of doing this. My intentent was not to answer how
"mustitasking works" but to give a few justifications why it is done and if one understands why it
is done and one understands the "operating system primitives" and one understands ones own
application then can make the most of the tools available.

Disclaimer: anyone may disagree with some of the particulars with what I said. I have had
experiences with all the above and many discussions with other professional about the above.

To make a long story short(I know its too late) but understanding why we want multitasking, then
how and when to make tasking switching work to make the application work and then use the "task
switching primitives" to get our application to work the best we can. Again I think Netmedia has
tried to give us a very good cost effective system.

Also don't ask for high end Cadilac solutions for low end VW prices. But I know of friends that
have done some amazing things with VW's.

Best of luck, Jack

Mark
--- Jack Wu <> wrote:
> How does multitasking work?
> say here is my code:
>
> Call PutByte(blah blah)
> Call PutByte(blah blah)
> Call PutByte(blah blah)
> Call PutByte(blah blah)
> Delay(0.1)
> Call GetByte(blah blah)
> Call GetByte(blah blah)
> Call GetByte(blah blah)
> Call GetByte(blah blah)
> ---------------------------------
> besides a pause of 100ms, what multitasking happens here?
>
> __________________________________________________
__________________________________________________






(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: How does multitasking work? - Ian Casey - Jan 7 18:14:00 2003

Hi,
I agree with Mark, as far as I'm concerned, Frank & Netmedia have done a
pretty good job.

I've smoked a couple of BX24's but that was my fault.

As for lock ups, I've had similar problems with programs in C code
(written by the 'experts'), they would hang after a month or two in the
field using a processor from the same Atmel family, but I haven't had
the same problem with the BX24, yet?

The NetMedia documentation leaves something to be desired, online help
would really be a help, but that's what this forum is for, it's an
ongoing project., it's alive and growing. As I heard recently from this
forum or others: Documentation is like Sex, when its good it's very
good, when its bad its still better than none!

Regards,
Ian




(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

RE: How does multitasking work? - Dan Bielecki - Jan 7 21:53:00 2003

Here's a virtual pat on the pat, Mark.

<Pat> <Pat> <Pat>

Couldn't have said it all any better.
Love the analogies of the systems.

.db. -----Original Message-----
From: Mark Newell [mailto:]
Sent: Tuesday, January 07, 2003 1:30 PM
To:
Subject: Re: [BasicX] How does multitasking work? Jack,

The fundamentals of multitasking is to switch from processes that are
waiting on an event to allow
other process that need cpu processing to run. There are several models
of
multiprocessing(multiprocessing) available: (1) large mainframe systems
that allow thousands of
users to use the same processor(s) as though they have a dedicated
processor to them (a very large
time sharing system costing millions of dollars) ; (2) "realtime systems"
that must process a
"real time event" at a specific time or the event is lost for ever. These
"realtime systems" have
to be sized to ensure nothing is gone unprocessed(and usually over sized).
An example might be a
system traveling through space that must make a turn at a point in space
or be lost for ever.
This is not to be confused with on-line systems like airlines
reseverations systems where if a
request processing is delayed a little the worst that is going to happen
is a missed seat on a
particualar plane. Or if the response time is too long the customer gets
upset and comes back
later. (3) the last type is a simple task switching switching that gives a
programmer some power
over when tasks are given a chance to run. There are normally some basic
operating systems
primitives built in that us as programmers some control how and when tasks
are switched and many
times that have to be designed in a "cooperative" mode. I my humble
opioion Netmedia has done a
very fine cost effective/function job of doing this. My intentent was not
to answer how
"mustitasking works" but to give a few justifications why it is done and
if one understands why it
is done and one understands the "operating system primitives" and one
understands ones own
application then can make the most of the tools available.

Disclaimer: anyone may disagree with some of the particulars with what I
said. I have had
experiences with all the above and many discussions with other
professional about the above.

To make a long story short(I know its too late) but understanding why we
want multitasking, then
how and when to make tasking switching work to make the application work
and then use the "task
switching primitives" to get our application to work the best we can.
Again I think Netmedia has
tried to give us a very good cost effective system.

Also don't ask for high end Cadilac solutions for low end VW prices. But I
know of friends that
have done some amazing things with VW's.

Best of luck, Jack

Mark
--- Jack Wu <> wrote:
> How does multitasking work?
> say here is my code:
>
> Call PutByte(blah blah)
> Call PutByte(blah blah)
> Call PutByte(blah blah)
> Call PutByte(blah blah)
> Delay(0.1)
> Call GetByte(blah blah)
> Call GetByte(blah blah)
> Call GetByte(blah blah)
> Call GetByte(blah blah)
> ---------------------------------
> besides a pause of 100ms, what multitasking happens here?
>
> __________________________________________________
__________________________________________________

Yahoo! Groups Sponsor
ADVERTISEMENT

Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. [Non-text portions of this message have been removed]




(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )