24-Apr-2024 16:58 GMT.
UNDER CONSTRUCTION
Anonymous, there are 114 items in your selection (but only 64 shown due to limitation) [1 - 50] [51 - 100] [101 - 114]
[Forum] OS4 design for ObtainSysList/ReleaseSysListANN.lu
Posted on 11-Jul-2004 20:44 GMT by adesigner (Edited on 2004-07-12 02:34:47 GMT by Christophe Decanini)114 comments
View flat
View list
"In the documentation of FindPort() it is said that you should use ObtainSysList(OSL_PORTLIST) and ReleaseSysList() instead of Forbit() and Permit() in OS4."
www.amigaworld.net thread

I believe this is broken design, you can't mix Forbid and semaphore locking. (Edit by Christophe: It has been confirmed that this solution was rejected for OS4) [sort of pseudo code follows]

" static struct MsgPort *Port;

int InitThePort(void)
{
struct MsgPort *newport;
int result = 0;

ObtainSysList(OSL_PORTLIST); /* Forbid(); */
Port = FindPort(MYPORTNAME);
if (Port) {
result = 2;
} else {
newport = AllocMem(sizeof(*newport), MEMF_PUBLIC);
if (newport) {
/* ... init newport ... */
AddPort(newport);
Port = newport;
result = 1;
} else result = 0;
} else result = 0;

ReleaseSysList(OSL_PORTLIST); /* Permit(); */
return result;
}
"

The problem here is that if some other app is using Forbid() locking, it can easily end up AddPort()ng duplicate port with the same name.

This can happen if task A using ObtainSysList reaches just before AddPort, and Task B using Forbid gets scheduled to run. This task will then Forbid, FindPort and get NULL too. Task B (that is run within Forbid) will now continue and create new port and add it to system via AddPort.

Next Task B Permits and lets other tasks run. Now Task A gets to run and continues to AddPort *duplicate* port.

Further problems may arise if application FindPorting for this port is using Forbid. There the port is actually found *before* InitThePort reaches ReleaseSysList. Now if some further initializing of resources is done before this call, messages might get lost in case these initializations fail, and the app assumes no messages can be in the port (the port list is locked after all, so there should't be any, right?).

RemPort has similar issues, but there the problem is that FindPort can find the port even after ObtainSysList is called for RemPort, and thus more messages might appear in the port even after this ObtainSysList.

Note that AddPort/FindPort itself must not break Forbid. There are a lot more ways that things can break down, I just listed some. Also here I only considered public port list, other system lists have even greater problems.

I ask developers to review these findings and if I am wrong, correct me.

OS4 design for ObtainSysList/ReleaseSysList : Comment 51 of 114ANN.lu
Posted by Fabio Alemagna on 12-Jul-2004 09:28 GMT
In reply to Comment 48 (Peter Gordon):
> Because its modifying a publically accessibly linked list.

Sure, I know that, but here we're talking about the 68k version of AddPort. It's probably possible to write it in such a way that accounts for the fact that the semaphore has already been locked once (by FindPort, in this case), in which case it would not lock it again.

I agree, though, that it would be a mess.
OS4 design for ObtainSysList/ReleaseSysList : Comment 52 of 114ANN.lu
Posted by Georg Steger on 12-Jul-2004 09:38 GMT
In reply to Comment 51 (Fabio Alemagna):
No, because FindPort unlocks the semaphore when exiting.
OS4 design for ObtainSysList/ReleaseSysList : Comment 53 of 114ANN.lu
Posted by Fabio Alemagna on 12-Jul-2004 10:13 GMT
In reply to Comment 52 (Georg Steger):
> No, because FindPort unlocks the semaphore when exiting.

Yes, but if AddPort doesn't lock it thereafter again, nothing bad can happen. Basically, what you want is a way to lock/unlock the semaphore only once per Forbid/Permit pair.
OS4 design for ObtainSysList/ReleaseSysList : Comment 54 of 114ANN.lu
Posted by Peter Gordon on 12-Jul-2004 10:54 GMT
In reply to Comment 53 (Fabio Alemagna):
So, to summarise, we all see that this approach is flawed and that it was right to ditch it. I don't really see any point of trying to make it work or find more flaws beyond this ;-)
OS4 design for ObtainSysList/ReleaseSysList : Comment 55 of 114ANN.lu
Posted by Christophe Decanini on 12-Jul-2004 12:52 GMT
In reply to Comment 49 (DET Nicolas):
I edited the main post as it was containing some flamebait.
OS4 design for ObtainSysList/ReleaseSysList : Comment 56 of 114ANN.lu
Posted by Johan Rönnblom on 12-Jul-2004 13:36 GMT
In reply to Comment 55 (Christophe Decanini):
Flamebait? Eeh. Well I don't notice any difference except the title,
which was something like "OS4 design flaw?" or something, maybe this
title is better but there was a questionmark and reading the item it
was quite clear that it was a question, not an accusation.
OS4 design for ObtainSysList/ReleaseSysList : Comment 57 of 114ANN.lu
Posted by Anonymous on 12-Jul-2004 16:04 GMT
In reply to Comment 25 (Johan Rönnblom):
maybe if he'd tried coding and compiling such an example he'd have seen
that it would compile or work!
OS4 design for ObtainSysList/ReleaseSysList : Comment 58 of 114ANN.lu
Posted by Neko on 12-Jul-2004 17:29 GMT
Isn't it time people stopped using those dumbass privacy/anonymiser sites?

None of them work outside of your current browser session. Why do you want to
stop AW.net knowing that you visited from ANN.lu?

Neko
OS4 design for ObtainSysList/ReleaseSysList : Comment 59 of 114ANN.lu
Posted by Thomas Frieden on 13-Jul-2004 08:03 GMT
In reply to Comment 24 (Fabio Alemagna):
> Me agreeing with an AOS4 design decision?

No, definitely not... otherwise, you wouldn't have the opportunity to lecture me, tell me what a general idiot I am, and basically tell me that everything you did before was so much better than everything I did.

Don't worry, the idea was rejected because it wouldn't go far enough. Future versions of the API will not allow you to access the system lists at all anymore. For lists that have some interest for applications, accessors will be used. The rest will just fail.

But don't worry, we're going to mess this up again, make stupid decisions as always, so you can continue feeling superior.
OS4 design for ObtainSysList/ReleaseSysList : Comment 60 of 114ANN.lu
Posted by Thomas Frieden on 13-Jul-2004 08:06 GMT
In reply to Comment 44 (Peter Gordon):
> maybe in the AutoDocs they'd state "WARNING: Only obtain one system list at a
> time" or something.

Uh, no, becuase this function never existed. It was planned, as I said, but never implemented. I was stupid enough to forget to remove the example in FindPort, though.
OS4 design for ObtainSysList/ReleaseSysList : Comment 61 of 114ANN.lu
Posted by Thomas Frieden on 13-Jul-2004 08:11 GMT
In reply to Comment 45 (Georg Steger):
> Forbid();
> if (!FindPort("bla"))
> {
> AddPort("bla");
> }
> Permit();

If there is a design flaw involved, this is it... it's how the original system did the arbitration. Instead of just using Semaphores for arbitrating system resources, it used Forbid. Unfortunately, a lot of programmers followed that paradigm.

For the current system, this of course still works, but poses a very big problem when moving to a multi-CPU system: What will you do with Forbid on a system with more CPUs ? Forbid will disable task switching. It would *NOT* make the system run single-threaded in a multi-CPU environment.

Therefore, the use of Forbid _MUST_ be discouraged as soon as possible. The idea was to make use of Semaphores to lock out access to system lists. However, since there is the problem with old programs just calling Forbid/Permit, we abandoned the idea.
OS4 design for ObtainSysList/ReleaseSysList : Comment 62 of 114ANN.lu
Posted by Thomas Frieden on 13-Jul-2004 08:15 GMT
In reply to Comment 49 (DET Nicolas):
> What's wrong in giving some polite critics anyway ?

The troll I was referring to was the original poster. He posted something without checking the facts, just to provoke flameing. He referred to a thread where it was already clearly said that these functions do not exist, yet he still brought up the post.

If he wanted to do some "polite criticism", he could have posted on AW.net. But that wasn't his intention. He was just out for flaming.
OS4 design for ObtainSysList/ReleaseSysList : Comment 63 of 114ANN.lu
Posted by Thomas Frieden on 13-Jul-2004 08:18 GMT
In reply to Comment 56 (Johan Rönnblom):
> Flamebait?

Yes. It wasn't a question. The question has already been answered on the AW.net thread, after 3 or 4 postings. AFTER it was brought here.

So no, there was no genuine question involved, just the usual anonymous troll flaming.

There's a difference between a question and flaming in the way the question is asked. It's clear that a blue-colored guy like you does not read a blue-colored question as cricital as me, but that doesn't mean it's not a flamebait.
OS4 design for ObtainSysList/ReleaseSysList : Comment 64 of 114ANN.lu
Posted by Anonymous on 13-Jul-2004 09:06 GMT
In reply to Comment 61 (Thomas Frieden):
"However, since there is the problem with old programs just calling Forbid/Permit, we abandoned the idea."

... in favour of ...?

Right now people are writing "official" OS4 PowerPC applications which, so you say, will cease working or cause untold mayhem on some future OS4.x version. That's not something users want to hear, and it's not something developers want to hear either. It renders the OS4 "developer pre-release" a mere PR exercise.
OS4 design for ObtainSysList/ReleaseSysList : Comment 65 of 114ANN.lu
Posted by Fabio Alemagna on 13-Jul-2004 09:54 GMT
In reply to Comment 59 (Thomas Frieden):
> [...]
> But don't worry, we're going to mess this up again, make stupid decisions as
> always, so you can continue feeling superior.

Oh dear, now one can't even make a funny remark anymore? Take it easy, dude, to paraphrase you: you take yourself way too seriously!

It's not my fault if I don't agree with your design decisions, in general, it's not about "feeling superior", it's just about not agreeing.

On the other hand, do you</b< think you are superior to other people in this community having made different design decision than yours, for their similar products? Do you?
OS4 design for ObtainSysList/ReleaseSysList : Comment 66 of 114ANN.lu
Posted by Fabio Alemagna on 13-Jul-2004 09:58 GMT
In reply to Comment 61 (Thomas Frieden):
> For the current system, this of course still works, but poses a very big problem
> when moving to a multi-CPU system: What will you do with Forbid on a system with
> more CPUs ? Forbid will disable task switching. It would *NOT* make the system
> run single-threaded in a multi-CPU environment.

Ehum... if it forbids task switching, it of course makes it impossible for other tasks to be scheduled, and thus makes the system run single-threaded.

Who says Forbid() has to work on a per-cpu basis?
OS4 design for ObtainSysList/ReleaseSysList : Comment 67 of 114ANN.lu
Posted by Fabio Alemagna on 13-Jul-2004 10:08 GMT
In reply to Comment 66 (Fabio Alemagna):
You could probably even implement Forbid() as a global semaphore and, of course, not make semaphores' implementation depend on Forbid() (which would cause a recursive loop).
OS4 design for ObtainSysList/ReleaseSysList : Comment 68 of 114ANN.lu
Posted by Fabio Alemagna on 13-Jul-2004 10:16 GMT
In reply to Comment 67 (Fabio Alemagna):
Btw, that would of course change the semantics of Forbid(), because then other tasks would still be free to be scheduled, however since Forbid()'s main purpose is to arbitrate access to critical code, nothing would really be affected. Any usage of Forbid() aimed solely at stopping multitasking, for whatever reason, of course wouldn't work, but that wouldn't have any particularly negative effecft.

The use of one global semaphore may not look good, however it's certainly better than stopping multitasking altogether, and it also solves the deadlock problem.

A general way to solce the deadlock problem, though, would be to not allow a task to hold more than one exclusive lock with "wait for release" semantic on an object.
OS4 design for ObtainSysList/ReleaseSysList : Comment 69 of 114ANN.lu
Posted by Peter Gordon on 13-Jul-2004 10:39 GMT
In reply to Comment 60 (Thomas Frieden):
Yes I know. I've stated several times over we're talking hypothetically here.
OS4 design for ObtainSysList/ReleaseSysList : Comment 70 of 114ANN.lu
Posted by Johan Rönnblom on 13-Jul-2004 13:51 GMT
In reply to Comment 63 (Thomas Frieden):
Thomas Frieden wrote:
> If he wanted to do some "polite criticism", he could have posted on
> AW.net. But that wasn't his intention.

I don't understand you here. So you think no one should discuss OS4
outside of AW.net? Come on, this is not North Korea.


> The troll I was referring to was the original poster. He posted
> something without checking the facts, just to provoke flameing. He
> referred to a thread where it was already clearly said that these
> functions do not exist, yet he still brought up the post.

Yes. He's talking about a design problem. It was stated in that thread
at aw.net that these functions aren't implemented yet. It wasn't
stated that the design had been changed. Thus, a discussion about a
possible flaw with such a design seems quite in place. I see nothing
"flamish" about this.


> There's a difference between a question and flaming in the way the
> question is asked. It's clear that a blue-colored guy like you does
> not read a blue-colored question as critical as me, but that doesn't
> mean it's not a flamebait.

Exactly how is that question blue-coloured? It doesn't mention
anything "blue", or make any comparisons. Also, as the discussion is
about something which has not yet been implemented, I don't understand
why some "evil blue person" would want to take this dicsussion up at
this point. Surely it would be more evil then to wait until you either
wasted time finding out about the flaw, or you missed it and released
something flawed?

Anyway, I see loads of such discussions about MorphOS or AROS, but no
MorphOS or AROS developers seem to take it as flamebaits.
OS4 design for ObtainSysList/ReleaseSysList : Comment 71 of 114ANN.lu
Posted by MIKE on 13-Jul-2004 14:32 GMT
In reply to Comment 70 (Johan Rönnblom):
>> Anyway, I see loads of such discussions about MorphOS or AROS, but no
>> MorphOS or AROS developers seem to take it as flamebaits.

They are more confident in their own abilities and choices.
OS4 design for ObtainSysList/ReleaseSysList : Comment 72 of 114ANN.lu
Posted by Johan Rönnblom on 13-Jul-2004 19:28 GMT
In reply to Comment 71 (MIKE):
It's not just about being confident in your ability, it's also about
being confident in your person. If you are, you'll have no problem
accepting that sometimes you may be wrong even in the areas where you
consider yourself to be an expert.
OS4 design for ObtainSysList/ReleaseSysList : Comment 73 of 114ANN.lu
Posted by Thomas Frieden on 14-Jul-2004 07:09 GMT
In reply to Comment 66 (Fabio Alemagna):
> Ehum... if it forbids task switching, it of course makes it impossible for other
> tasks to be scheduled, and thus makes the system run single-threaded.

Wrong. On a single CPU system, this is true, but on a multi CPU system, Forbid just forbids task switching, which means that *TWO* threads are running (on a dual CPU system). This is *NOT* single-threaded. Both CPUs could access, for example, the port list at the same time. Therefore, Forbid is a stupid way of locking.
OS4 design for ObtainSysList/ReleaseSysList : Comment 74 of 114ANN.lu
Posted by Thomas Frieden on 14-Jul-2004 07:11 GMT
In reply to Comment 67 (Fabio Alemagna):
> You could probably even implement Forbid() as a global semaphore and, of course,
> not make semaphores' implementation depend on Forbid() (which would cause a
> recursive loop).

Not even then. Sure, you can implement Forbid as a semaphore lock on the task list. But even then, on a multi-cpu system, multiple programs are still running. The only possibility to expand Forbid to the way it's now on a multi-CPU system is to stop all other CPUs from working.
OS4 design for ObtainSysList/ReleaseSysList : Comment 75 of 114ANN.lu
Posted by Thomas Frieden on 14-Jul-2004 07:15 GMT
In reply to Comment 70 (Johan Rönnblom):
> I don't understand you here. So you think no one should discuss OS4
> outside of AW.net? Come on, this is not North Korea.

That's not what I said. However, the thread was currently on AW.net, and he had to take it here so it's more visible, and so he could give it an "appropriate" tag line.


> Yes. He's talking about a design problem.

No, he isn't. He's talking about hot air. The fact that he knew about the function showed that he read the AW.net thread, and this thread said explicitly that the function does not exist, in the third posting. He knew it wasn't there, but had to start "discussion" about it, anyway...


> Anyway, I see loads of such discussions about MorphOS or AROS, but no
> MorphOS or AROS developers seem to take it as flamebaits

Yeah, sure.
OS4 design for ObtainSysList/ReleaseSysList : Comment 76 of 114ANN.lu
Posted by Thomas Frieden on 14-Jul-2004 07:18 GMT
In reply to Comment 71 (MIKE):
> They are more confident in their own abilities and choices.

That's stupid babble.
OS4 design for ObtainSysList/ReleaseSysList : Comment 77 of 114ANN.lu
Posted by Fabio Alemagna on 14-Jul-2004 08:32 GMT
In reply to Comment 73 (Thomas Frieden):
> Wrong. On a single CPU system, this is true, but on a multi CPU system, Forbid
> just forbids task switching, which means that *TWO* threads are running (on a
> dual CPU system).

Again, who says that? It all depends on _how_ you implement Forbid().

> This is *NOT* single-threaded. Both CPUs could access, for example, the port
> list at the same time. Therefore, Forbid is a stupid way of locking.

Uh. If it disables task switching on _both_ CPU's, that can never happen.
OS4 design for ObtainSysList/ReleaseSysList : Comment 78 of 114ANN.lu
Posted by Fabio Alemagna on 14-Jul-2004 08:33 GMT
In reply to Comment 74 (Thomas Frieden):
> Not even then. Sure, you can implement Forbid as a semaphore lock on the task
> list.

That wasn't my idea, but never mind...

> But even then, on a multi-cpu system, multiple programs are still running. The
> only possibility to expand Forbid to the way it's now on a multi-CPU system is
> to stop all other CPUs from working.

And isn't that what I said before?
OS4 design for ObtainSysList/ReleaseSysList : Comment 79 of 114ANN.lu
Posted by priest on 14-Jul-2004 10:01 GMT
In reply to Comment 77 (Fabio Alemagna):
>> This is *NOT* single-threaded. Both CPUs could access, for example, the port
>> list at the same time. Therefore, Forbid is a stupid way of locking.
>Uh. If it disables task switching on _both_ CPU's, that can never happen.

So, the other/third/fourth CPU can not start to run a new task...
but what happens with those tasks that were already running on those other CPUs?

They would need to be stopped totally, right?
OS4 design for ObtainSysList/ReleaseSysList : Comment 80 of 114ANN.lu
Posted by Fabio Alemagna on 14-Jul-2004 10:31 GMT
In reply to Comment 79 (priest):
> So, the other/third/fourth CPU can not start to run a new task...

Exactly.

> but what happens with those tasks that were already running on those other CPUs?
> They would need to be stopped totally, right?

Nope, they wouldn't have to, unless they called Forbid() while another task already was in Forbid() state.
OS4 design for ObtainSysList/ReleaseSysList : Comment 81 of 114ANN.lu
Posted by Fabio Alemagna on 14-Jul-2004 10:35 GMT
In reply to Comment 80 (Fabio Alemagna):
> Nope, they wouldn't have to, unless they called Forbid() while another task
> already was in Forbid() state...

... at which point they would be put in a wait list, much like with a semaphore.

However, the simplest approach is to halt all other tasks running on all other CPU's as well, using Forbid() as the synchronization point across the CPUs.

In a way or another, though, Forbid() will have to be implemented on multi-cpu systems, you can't simply not implement it, because so many applications rely on it, and not just to protect critical sections of code.

So, unless Hyperion want to ditch compatibility with AmigaOS3.x (which in turn means getting rid of an huge software base), they must find a way around it.
OS4 design for ObtainSysList/ReleaseSysList : Comment 82 of 114ANN.lu
Posted by pixie on 14-Jul-2004 18:22 GMT
Disclaimer:
I don't know much about programming, you've been warned...

I suppose this already been implemented as programs do run in AmigaOS 4, as I see what this guides represent a way so that new programs can make use of SMP... can be wrong though...
OS4 design for ObtainSysList/ReleaseSysList : Comment 83 of 114ANN.lu
Posted by Ketzer on 16-Jul-2004 07:35 GMT
In reply to Comment 77 (Fabio Alemagna):
Nonsense. Two running tasks, you disable task switching and you still have two running tasks.
OS4 design for ObtainSysList/ReleaseSysList : Comment 84 of 114ANN.lu
Posted by Ketzer on 16-Jul-2004 07:38 GMT
In reply to Comment 80 (Fabio Alemagna):
You realize that you replace one concurrency problem with another, right?
OS4 design for ObtainSysList/ReleaseSysList : Comment 85 of 114ANN.lu
Posted by Ketzer on 16-Jul-2004 07:42 GMT
In reply to Comment 84 (Ketzer):
Hint: You would have to protect Forbid() against being called twice at the same time from two running tasks on two cpus (or more).
OS4 design for ObtainSysList/ReleaseSysList : Comment 86 of 114ANN.lu
Posted by Ketzer on 16-Jul-2004 07:44 GMT
In reply to Comment 81 (Fabio Alemagna):
Some things are better left behind for good. And Forbid() in a multitasking evironment is *the* prime example.
OS4 design for ObtainSysList/ReleaseSysList : Comment 87 of 114ANN.lu
Posted by Ketzer on 16-Jul-2004 08:37 GMT
Btw, a possible, less multitasking threatening solution could be this ...

Sytem Semaphores B, C, D, with each corresponding to a system list.
Add another "global" semaphore A.

(New) task wants to access system list C. Allocates semaphore C which in turn uses a read allocation on semaphore A.

(Old) task calls Forbid() which in turn uses a write allocation on semaphore A.

Almost no impact if the system doesnt use old programs.
OS4 design for ObtainSysList/ReleaseSysList : Comment 88 of 114ANN.lu
Posted by Fabio Alemagna on 16-Jul-2004 08:50 GMT
In reply to Comment 83 (Ketzer):
> Nonsense. Two running tasks, you disable task switching and you still have two
> running tasks.

Yes, so? If they both use Forbid() to protect critical sections then nothing bad happens, as long as Forbid() acts as a semafore too, or even just a spinlock.
OS4 design for ObtainSysList/ReleaseSysList : Comment 89 of 114ANN.lu
Posted by Fabio Alemagna on 16-Jul-2004 08:51 GMT
In reply to Comment 84 (Ketzer):
> You realize that you replace one concurrency problem with another, right?

Ehum?! :-D
OS4 design for ObtainSysList/ReleaseSysList : Comment 90 of 114ANN.lu
Posted by Fabio Alemagna on 16-Jul-2004 08:52 GMT
In reply to Comment 85 (Ketzer):
> Hint: You would have to protect Forbid() against being called twice at the same
> time from two running tasks on two cpus (or more).

Hint1: semaphores.
Hint2: spinlocks.
Hint3: go study some books about SMP.
OS4 design for ObtainSysList/ReleaseSysList : Comment 91 of 114ANN.lu
Posted by Fabio Alemagna on 16-Jul-2004 08:53 GMT
In reply to Comment 86 (Ketzer):
> Some things are better left behind for good.

Some things just can't. If you do, you lose 90% of compatibility.
OS4 design for ObtainSysList/ReleaseSysList : Comment 92 of 114ANN.lu
Posted by Fabio Alemagna on 16-Jul-2004 08:58 GMT
In reply to Comment 87 (Ketzer):
That's _exactly_ what I proposed a few messages earlier (the global semaphore thing) to which Mr Frieded replied it was bullshit.

However, Forbid() does need to block multitasking too, because many programs rely on it, even if they probably shouldn't.

Marti Blom gave a good example on the AROs-Dev ML, which doesn't even break any rules: often, if two or more tasks are accessing shared data, then only the low priority ones need to use Forbid(), the one with highest priority doesn't need to, because it knows that if it has higher priority than the others, then the others will never preempt it.

You see, a global semaphore would solve exactly nothing here.
OS4 design for ObtainSysList/ReleaseSysList : Comment 93 of 114ANN.lu
Posted by Ketzer on 16-Jul-2004 09:13 GMT
In reply to Comment 90 (Fabio Alemagna):
Not saying it cant be done, but its more hassle than its worth.
OS4 design for ObtainSysList/ReleaseSysList : Comment 94 of 114ANN.lu
Posted by Ketzer on 16-Jul-2004 09:19 GMT
In reply to Comment 91 (Fabio Alemagna):
IMO Then be it so. Its hardly 90% anyway.
OS4 design for ObtainSysList/ReleaseSysList : Comment 95 of 114ANN.lu
Posted by Ketzer on 16-Jul-2004 09:34 GMT
In reply to Comment 92 (Fabio Alemagna):
> That's _exactly_ what I proposed a few messages earlier (the global semaphore thing) to which Mr Frieded replied it was bullshit.

Ok, if thats what you meant. (Btw, he understood it in a different way, which i did too. And there certainly wasnt a "bullshit" comment.)

> However, Forbid() does need to block multitasking too, because many programs rely on it, even if they probably shouldn't.

It does? I cant think of any legal use of that ... maybe timing something. Anyway, what are those "many programs [that] rely on it"? I find that greatly exaggerated.

> Marti Blom gave a good example on the AROs-Dev ML, which doesn't even break any rules: often, if two or more tasks are accessing shared data, then only the low priority ones need to use Forbid(), the one with highest priority doesn't need to, because it knows that if it has higher priority than the others, then the others will never preempt it.

Such relying on implementation details is what got us into that compatibility mess to start with. So imo, break it, better now than never.

> You see, a global semaphore would solve exactly nothing here.

Sure, in that particular case, but again, what program actually uses that?
OS4 design for ObtainSysList/ReleaseSysList : Comment 96 of 114ANN.lu
Posted by Ketzer on 16-Jul-2004 09:44 GMT
In reply to Comment 88 (Fabio Alemagna):
I was replying to this ...

>> This is *NOT* single-threaded. Both CPUs could access, for example, the port
>> list at the same time. Therefore, Forbid is a stupid way of locking.

>Uh. If it disables task switching on _both_ CPU's, that can never happen.

... which is not true. As you say now, you also have to add another protection besides disabling task switches - which makes the disabling somewhat useless.
OS4 design for ObtainSysList/ReleaseSysList : Comment 97 of 114ANN.lu
Posted by Fabio Alemagna on 16-Jul-2004 10:15 GMT
In reply to Comment 93 (Ketzer):
> Not saying it cant be done, but its more hassle than its worth.

It's a requirement. Hassle or not, it has to be done.
OS4 design for ObtainSysList/ReleaseSysList : Comment 98 of 114ANN.lu
Posted by Fabio Alemagna on 16-Jul-2004 10:30 GMT
In reply to Comment 95 (Ketzer):
> It does? I cant think of any legal use of that ...

1) All startup code for programs being able to be launched by Workbench are required to stop multitasking, via Forbid(), just befor existing, in order to not have their seglist deallocated while still running.

That's one of the legal uses.

Then there are also other uses which rely on particular implementations of various functions, which i agree is a bad thing to do, but those programs are there, if you still want to use them, you need to provide such "functionalities".

For example (code snip provided by Martin blom):

---<8---
Forbid();

task = CreateTask(...);
task->UserData = foo;

Permit();
---8>---

The above code relies on the assumption that CreateTask() doesn't break the forbid state. Still, Martin Blom says that he uses it all the times, and that he saw a lot of code using that too.

> maybe timing something. Anyway, what are those "many programs [that] rely on
> it"? I find that greatly exaggerated.

The fact you don't happen to see the source code of 99% of the programs existing for AmigaOS should tell you that you cannot possibly conclude that the claim is "greatly exagerated". You conclude that just because you would never use such ways of doing things, but others do use them.


> Such relying on implementation details is what got us into that compatibility
> mess to start with. So imo, break it, better now than never.

That's not an implementation detail, it's a specification requirement. A task with higher priority than another task will never be preempted by that other task. This is a requirement of the interface, not an implementation detail. What would be the point in having priorities at all, if the scheduler were able to give whatever meaning that it wanted?

> > You see, a global semaphore would solve exactly nothing here.

> Sure, in that particular case, but again, what program actually uses that?

Apparently, more than you'd like to know.

Reply to this comment | Top
OS4 design for ObtainSysList/ReleaseSysList : Comment 99 of 114ANN.lu
Posted by Fabio Alemagna on 16-Jul-2004 10:30 GMT
In reply to Comment 96 (Ketzer):
> > Uh. If it disables task switching on _both_ CPU's, that can never happen.

> ... which is not true. As you say now, you also have to add another protection
> besides disabling task switches - which makes the disabling somewhat useless.

It was implicit. I assumed anyone with a grain of salt would understand it.
OS4 design for ObtainSysList/ReleaseSysList : Comment 100 of 114ANN.lu
Posted by Ketzer on 16-Jul-2004 10:39 GMT
In reply to Comment 97 (Fabio Alemagna):
Have to disagree.
Anonymous, there are 114 items in your selection (but only 64 shown due to limitation) [1 - 50] [51 - 100] [101 - 114]
Back to Top