Pumpkin, Inc.

Pumpkin User Forums

Differences between BINSEM and SEM?

Have an idea on how to make Salvo better? Post it here!

Differences between BINSEM and SEM?

Postby luben » Tue Sep 03, 2002 9:13 am

Hello,

After working so long time with SALVO I wish to share some ideas about BINSEM and counting SEMaphores. In my oppinion they are very, very close services and they could be managed from one and the same service with very small changes.

BINSEM are in fact SEMAPHORE that could be signalled only once, I mean if the function that signals semaphore looks like:
.... semaphore_counter++;

the function that signals BINSEM is :
..... semaphore_counter = 1;

All other services should be absolutely equal.

That means - the both services of SEMAPHORE and BINSEMAPHORE could be merged in one service, that has differences only when signaling the event.

Well, sometimes you can use long semaphores (16 bits), that means - if the BINSEM and SEM use absolutely the same service the BINSEM will use more RAM for longer variables.

These are some thoughts about semaphores that could help you to reduce more the code of SALVO.

Regards
Luben

luben
 
Posts: 324
Joined: Sun Nov 19, 2000 12:00 am
Location: Sofia, Bulgaria

Re: Differences between BINSEM and SEM?

Postby luben » Tue Sep 03, 2002 10:29 am

Hello,

After I get the reply on my issue "What happens if counting SEMAPHORE overruns " I see that counting semaphores have some "limiter", protecting them not to overrun.
So, one 8 bit semaphore has "limiter" of value "256".

If this "limiter" is set to value 1 - we'll get BINSEM functionality, right?

I mean - SEM and BINSEM have so many similar things, that it's quite possible to be merged somehow into one single service.

Regards
Luben

luben
 
Posts: 324
Joined: Sun Nov 19, 2000 12:00 am
Location: Sofia, Bulgaria

Re: Differences between BINSEM and SEM?

Postby aek » Wed Sep 04, 2002 8:37 am

Hi Luben.

This is a very interesting point.

You have Salvo Pro, if I remember correctly.

In salvo.h, change

code:
#if !OSBIG_SEMAPHORES                     
typedef OStypeInt8u OStypeSem;
#define MAX_SEM 255
#else
typedef OStypeInt16u OStypeSem;
#define MAX_SEM 32767
#endif

to
code:
#if !OSBIG_SEMAPHORES                     
typedef OStypeInt8u OStypeSem;
#ifndef MAX_SEM
#define MAX_SEM 255
#endif
#else
typedef OStypeInt16u OStypeSem;
#ifndef MAX_SEM
#define MAX_SEM 32767
#endif
#endif

and then #define MAX_SEM to 1 in your salvocfg.h.

I haven't tried it, but I think it will work ...

Regards,

------------------

[This message has been edited by aek (edited September 04, 2002).]

-------
aek
aek
 
Posts: 1886
Joined: Sat Aug 26, 2000 11:00 pm

Re: Differences between BINSEM and SEM?

Postby aek » Wed Sep 04, 2002 8:43 am

Hi Luben.

What I wrote below won't help because it's a compile-time issue. What you want is a runtime function like this, right?

code:
OSSignalSem(sem, MAX_VALUE)

It requires passing an extra argument, but it probably would reduce codesize. OSSignalBinSem() would become a macro ...

Regards,

------------------

-------
aek
aek
 
Posts: 1886
Joined: Sat Aug 26, 2000 11:00 pm

Re: Differences between BINSEM and SEM?

Postby luben » Wed Sep 04, 2002 10:55 am

Hello,

Maybe the right place to make one semaphore counting or binary is not the OSSignal but OSCreateXYZ. It should add some "limiter" - 1 for BINSEM and 256 to counting semaphores. Then the user should know which is counting and which BIN semaphore.

In short - my idea is to merge all semaphores into one "MEGA" SEMAPHORE. When created with limiter 256 - it's counting semaphore, when created with limiter 1 - BINARY.

Something like:
OSCreateSem(name_of_SEMAPHORE, value, TYPE_OF_SEMAPHORE);

and for the type of semaphore
#define TYPE_BINSEM 1
#define TYPE_COUNT_SEM 256

It's just my vision.

Regards
Luben

[This message has been edited by luben (edited September 04, 2002).]

luben
 
Posts: 324
Joined: Sun Nov 19, 2000 12:00 am
Location: Sofia, Bulgaria

Re: Differences between BINSEM and SEM?

Postby tbims23822 » Wed Jul 08, 2009 11:05 am

www.drop-shopping.com is a premium website for cheap air jordans shoes and other more really nike air jordan shoes.We have varity of cheap air jordan shoes available for wholesale.Cheap China wholesale shoes including cheap Nike shoes and cheap jordan shoes,nike sneakers,nike sneakers discount,air jordan sneakers,air force sneakers.We supply nike sneakers,jordan sneakers,air jordan sneakers,air force sneakers wholesale.You can buy very cheap jordans shoes including cheap women shoes,cheap nike shoes,cheap running shoes from us.

tbims23822
 


Return to Feature Requests

Who is online

Users browsing this forum: No registered users and 1 guest

cron