Phone, Tablet and Gizmo Thread #0x02

All threads that are locked or marked for deletion will be moved to this forum. The topics will be cleared from this archive on the 1st and 16th of each month.
Post Reply
anishns
BRFite
Posts: 1382
Joined: 16 Dec 2007 09:43
Location: being victim onlee...

Re: Phone, Tablet and Gizmo Thread #0x02

Post by anishns »

WOL works even if the computer has been shut down or hibernating
Check the BIOS if there is anything to enable WOL in there....

I have been using it for a long time through DD-WRT (If your router supports it!)
http://www.dd-wrt.com/wiki/index.php/WOL
saip wrote:
ArmenT wrote:Yes, but have you changed your firewall settings to support wake on LAN. Most of the cards I've seen that support Wake on LAN use UDP packets for that, whereas RDP uses the TCP protocol to work. You need to configure your firewall so that it routes packets sent to UDP port 7 or 9 (depending on card model) to your desktop.
Yea I did all that. What is happening is the computer wakes up during the first minute or two. But after that it does not. Which means the packets are coming through. Obviously there are different stages of sleep. The computer seems to go into deeper sleep (just like humans) after a few minutes and nothing from the internet will wake it up.
Raja Bose
BRF Oldie
Posts: 19477
Joined: 18 Oct 2005 01:38

Re: Phone, Tablet and Gizmo Thread #0x02

Post by Raja Bose »

Anujan wrote:Or is it just a case of "In my time, we walked 10 miles uphill to go to school and another 10 miles uphill :lol: to come back home"
Its just a case of the above. If I had a Paki rupee for every oldie who bitched about the "new" generation computers systems and programmers, I would be Mian Nawaz Sharif. If everything was so cool and wonderphool back in the old days, how come things didn't stay that way or did the field of technology change just for the sake of change...something which I doubt even slick YumBeeAyes can pull off on a large scale, forget big slobby engineers wearing soup stained ties.

Mean-e-while, Notion Ink is back (OK...on paper :mrgreen: ).

Notion Ink renders show Adam II, accessories and EVE smartphone

Image
Singha
BRF Oldie
Posts: 66589
Joined: 13 Aug 2004 19:42
Location: the grasshopper lies heavy

Re: Phone, Tablet and Gizmo Thread #0x02

Post by Singha »

oh wow they are getting into smartphones now...when can I pre-pay 25K and lock mine in for the 10 odd production run? :mrgreen:

btw did all the apple haters who purchased the adam-1 get any form of sw update or support now? the entire co seems to be behind a black screen that says "busy creating , back soon" ... uh how about a support system you clowns? :lol:
Singha
BRF Oldie
Posts: 66589
Joined: 13 Aug 2004 19:42
Location: the grasshopper lies heavy

Re: Phone, Tablet and Gizmo Thread #0x02

Post by Singha »

anyone have experience with lenovo android phones? there are a couple of models with 3500-4500mah batteries (thick ones) for a huge talktime....i am thinking of guiding my wife to get one of those or maybe the samsung grand quattro(screen is not that good) since her hand-me-down phone is suffering old age pains.

this is available and much cheaper than mrp on flipkart (12500)
http://shopap.lenovo.com/in/en/smartpho ... index.html
Raja Bose
BRF Oldie
Posts: 19477
Joined: 18 Oct 2005 01:38

Re: Phone, Tablet and Gizmo Thread #0x02

Post by Raja Bose »

Some of the Lenovo phones seem to be real good offerings and these guys are getting better all the time. Its just a question of when rather than if in terms of them giving Sammy a run for their money. Never used a retail unit hence cant comment on their reliability/daily performance.
Singha
BRF Oldie
Posts: 66589
Joined: 13 Aug 2004 19:42
Location: the grasshopper lies heavy

Re: Phone, Tablet and Gizmo Thread #0x02

Post by Singha »

yes they certainly have the financial muscle and global footprint to rival samsung and its ecosystem of components.
they must be sharpening their knives for the fight.
Raja Bose
BRF Oldie
Posts: 19477
Joined: 18 Oct 2005 01:38

Re: Phone, Tablet and Gizmo Thread #0x02

Post by Raja Bose »

There you have it from the horse's mouth....

Nokia chose Windows Phone because it feared Samsung would 'come to dominate Android'
What concerned Nokia about becoming an Android manufacturer, then, was that it wouldn't be able to scale up quick enough to compete with incumbents — particularly Samsung — which, at that time, already had a bit of a foothold in the market. As Elop said last week, "we were respectful of the fact that we were quite late in making that decision. Many others were in that space already."
The company also saw an opportunity to market itself as an alternative to Apple and Samsung. Elop told reporters that Nokia can more easily negotiate with carriers — which hold the keys to many markets like the US — as they want to talk "with different people and keep pressure on everybody and have the best range of options, [they want] that third alternative." He added, "So strategically we have an opening with AT&T and every other operator in the world... because we've taken that path as the third ecosystem."
Many people fail to see this hedging game carriers play on a daily basis with HW manufacturers. Telecom carriers are one of the worst parasites in US business - they need their mush whipped urgently.
Singha
BRF Oldie
Posts: 66589
Joined: 13 Aug 2004 19:42
Location: the grasshopper lies heavy

Re: Phone, Tablet and Gizmo Thread #0x02

Post by Singha »

wife finally going for 620 lumia. the bold colour, good camera, modest size, nok build and call quality and curved corner did the trick. that shop is next to mcdonalds fortunately.
Raja Bose
BRF Oldie
Posts: 19477
Joined: 18 Oct 2005 01:38

Re: Phone, Tablet and Gizmo Thread #0x02

Post by Raja Bose »

^^^One thing which WindozePhunwa got it right is their UX is uniformly smooth across all price ranges of their products unlike Android. I am really curious to know the margins on the low end Lumias GB is selling nowadays.
Raja Bose
BRF Oldie
Posts: 19477
Joined: 18 Oct 2005 01:38

Re: Phone, Tablet and Gizmo Thread #0x02

Post by Raja Bose »

^^Blashphemers, be prepared to face brim and firestone rained down by the Mahdi. FruitCo invented curved corners! :evil:
vina
BRF Oldie
Posts: 6046
Joined: 11 May 2005 06:56
Location: Doing Nijikaran, Udharikaran and Baazarikaran to Commies and Assorted Leftists

Re: Phone, Tablet and Gizmo Thread #0x02

Post by vina »

Pandyan wrote:Even a basic/innocuous webserver/webservice does that. programmer writes a single threaded code and IIS/Apache let's you scale by parallelizing the work and lets you scale based on demand
Exactly. That is why I wrote that bit about WebServer /App Server having that kind of functionality built in. With frameworks such as Swing and stuff like EJB, no DOO is going to do anything on the server side with threading and rubbish. It will be just a single threaded changu-mangu program which gets deployed with all that functionality. Thank goodness for that.
Pandyan wrote:Mickey/Chipzilla Thread building blocks etc provides automatic thread management capability.
So, there are several tools in developers tool chest now to do what you are asking for without breaking the bank.
Yes, stuff like Boost libraries etc are a good step, but why go that route at all, and let DOOs muck things up. That is the question. Take it away from them. :D
Saik wrote:also, there is tremendous capabilities lies in non-blocking i/os.. os controlled, one could do 1000s of process using this approach. ideally done by containers of services and process/threads that needs to wait, and free up cpu for other works.
EXACTLY. The way, that all those webservers and "internet architecture" scales up to multi million transactions with fast response is fundamentally the same as CICS and other TP monitors. They use what is called as Pseudo Conversational Transaction. Remember, HTTP too is a stateless protocol and the context is lost between conversations. Say between clicking on stuff and putting it on a shopping cart and finally clicking buy, the context is lost . The context is actually stored on the server side and retrieved via the cookie ? ,info that travels between the browser and Web/App Server.

The same thing is done in CICS. The difference is that in the "container and services" world (that I have seen until now), the server side thread is still alive (albeit in sleep/wait , along with locks to database etc), while in CICS, everything is released, which leads to even higher throughput. So, really internet transactions is basically CICS kind of model implemented in a browser & server mode (you do have client server version of CICS as well). So welcome back to 1975 ji!
Anujan wrote: 1) Writing thread safe code is a pain. Writing reentrant code is a pain in the mushrraf.
2) Partition level memory protection instead of thread level protection.
3)Are you sure that systems of old were really that awesome? I mean the reason I find it hard to believe is because CS has made significant advances in memory consistency models, address space protection, and programming models that hide things like requirement to write renetrant code -- all in the past decade and a half. Or is it just a case of "In my time, we walked 10 miles uphill to go to school and another 10 miles uphill to come back home"
1) Fundamentally all the code one writes is re-entrant, which basically means that the code segment is invariant. What used to be the case is that some Cobol versions of the 60s, allowed the code segment to be changed via instructions. That is a non issue. All shops would have upgraded their compilers when they got CICS and the default settings would compile fully re-entrant code only. So this really is a non issue.

To screw things up, you need to go back, write some really malicious code and change compiler settings to compile it to 60s style stuff (which most shops wont allow you to do, and if at all, they do , it usually will be for any program from 60s backward compatability, only allow you to run it not in CICS, but under MVS) and somehow get the CICS admin to authorize you to load that.

Other than that, effort and anything wise, you don' need anything beyond writing a changu-mangu "Hello World" program, because, by default , a "Hello World" program is fully re-entrant (in any language and platform usually).

2) But remember, each of the thread doesn't have mutexes and pointer arithmetic and no memory handling (like using malloc() ) , so, it is quite okay to have memory protection at that level, instead of thread level. That said, CICS is no as bullet proof as DB2 under MVS (a fully tasked system , unlike Oracle and others which do threading, it is unheard of DB2 to crash, while Oracle and others do crash) and does crash on extremely rare occasions.

3) Refer back to 1). Writing re-entrant code is not an issue. Your normal changu mangu code is re-entrant (without all that mutexes and threads and dynamic memory allocation etc ) . In fact, it is quite easy. Just write straight logic and leave the rest of that stuff to the system , so programming wise it is in fact easier . The thing is ,that tools wise, the SDKs in other platforms were streets ahead of what you got for CICS and old IBM systems , that automated a lot of stuff and improved productivity.
Anujan
Forum Moderator
Posts: 7900
Joined: 27 May 2007 03:55

Re: Phone, Tablet and Gizmo Thread #0x02

Post by Anujan »

Re-entrant code is not invariant code. These are fundamentally different things.

Modern operating systems mark the code segment as read only, so you cannot normally write self modifying code. Then why do people still care about writing re-entrant code?

This is a good example of a thread safe but not re-entrant code. Notice that the code is not self modifying in any way.

http://blogs.msdn.com/b/oldnewthing/arc ... 68719.aspx

You are a reasonably good programmer if you can spot right off the bat why the code is thread safe but not re-entrant. No points if you read the explanation. Subtle bugs like this creep in if you have to write re-entrant code. Remember that I said writing thread safe code is painful, writing re-entrant code is doubly painful. I do both for a living.
Last edited by Anujan on 20 Jul 2013 12:56, edited 3 times in total.
member_20292
BRF Oldie
Posts: 2059
Joined: 11 Aug 2016 06:14

Re: Phone, Tablet and Gizmo Thread #0x02

Post by member_20292 »

Raja Bose wrote:^^^One thing which WindozePhunwa got it right is their UX is uniformly smooth across all price ranges of their products unlike Android. I am really curious to know the margins on the low end Lumias GB is selling nowadays.
margin is quite solid.

15k phone dealer gets it for 12k

Nokia bom plus everything I expect to be 9 to 10 k.

horses mouth.....
Yogi_G
BRF Oldie
Posts: 2449
Joined: 21 Nov 2008 04:10
Location: Punya Bhoomi -- Jambu Dweepam

Re: Phone, Tablet and Gizmo Thread #0x02

Post by Yogi_G »

SHQ left her Samsung Wave (8500) all night in the rain on the roof. was switched off when we realized it in the morning and it was wet as hell. Dried it up, charged it up and it works now without a flaw :eek:
Singha
BRF Oldie
Posts: 66589
Joined: 13 Aug 2004 19:42
Location: the grasshopper lies heavy

Re: Phone, Tablet and Gizmo Thread #0x02

Post by Singha »

the 620 has a drawback of a smaller 3.8" screen vs 4.3" on all its siblings. the 720 looks smooth and sleek...I am all for it.
went into a samsung shop too - got a migraine from looking at the SAMENESS of phones from g-duos upto the S4 incl the obese 5.8 and 6.3 inch mega models /
Mort Walker
BRF Oldie
Posts: 10372
Joined: 31 May 2004 11:31
Location: The rings around Uranus.

Re: Phone, Tablet and Gizmo Thread #0x02

Post by Mort Walker »

Raja Bose wrote:Some of the Lenovo phones seem to be real good offerings and these guys are getting better all the time. Its just a question of when rather than if in terms of them giving Sammy a run for their money. Never used a retail unit hence cant comment on their reliability/daily performance.
Lenovo's mid to high range notebooks are getting better too, but the price goes up as well. The Lenovo Idea Pad S series with Win8 and touchscreen are nice as well as their higher end thin ThinkPad. I would say they are better than Dell and HP on the mid to high end.
Mort Walker
BRF Oldie
Posts: 10372
Joined: 31 May 2004 11:31
Location: The rings around Uranus.

Re: Phone, Tablet and Gizmo Thread #0x02

Post by Mort Walker »

Singha wrote:the 620 has a drawback of a smaller 3.8" screen vs 4.3" on all its siblings. the 720 looks smooth and sleek...I am all for it.
went into a samsung shop too - got a migraine from looking at the SAMENESS of phones from g-duos upto the S4 incl the obese 5.8 and 6.3 inch mega models /

The Lumia 620 is a good phone and priced well. What is it priced at in desh? In the US you can pick it up unlocked contract free for $200.
saip
BRF Oldie
Posts: 4383
Joined: 17 Jan 2003 12:31
Location: USA

Re: Phone, Tablet and Gizmo Thread #0x02

Post by saip »

Yogi_G wrote:SHQ left her Samsung Wave (8500) all night in the rain on the roof. was switched off when we realized it in the morning and it was wet as hell. Dried it up, charged it up and it works now without a flaw :eek:
I washed my phone (Motorola Razr) twice in the washing machine and it continued to work!
Singha
BRF Oldie
Posts: 66589
Joined: 13 Aug 2004 19:42
Location: the grasshopper lies heavy

Re: Phone, Tablet and Gizmo Thread #0x02

Post by Singha »

620 is around 12500 here.
Raja Bose
BRF Oldie
Posts: 19477
Joined: 18 Oct 2005 01:38

Re: Phone, Tablet and Gizmo Thread #0x02

Post by Raja Bose »

Yogi_G wrote:SHQ left her Samsung Wave (8500) all night in the rain on the roof. was switched off when we realized it in the morning and it was wet as hell. Dried it up, charged it up and it works now without a flaw :eek:
Just to be safe switch it off and leave it overnight buried in a container of rice. Simply air drying may not get rid of all moisture and trapped moisture works in mysterious ways in tightly packed phunwas.
vina
BRF Oldie
Posts: 6046
Joined: 11 May 2005 06:56
Location: Doing Nijikaran, Udharikaran and Baazarikaran to Commies and Assorted Leftists

Re: Phone, Tablet and Gizmo Thread #0x02

Post by vina »

Anujan wrote:Re-entrant code is not invariant code. These are fundamentally different things.
I didn't say they were. However, for a code to be reentrant, invariant code is a necessary condition, though not sufficient.
Modern operating systems mark the code segment as read only, so you cannot normally write self modifying code. Then why do people still care about writing re-entrant code?
I have no idea why you would be bothered with re-entrancy in a non CICS kind of world, please do explain.
This is a good example of a thread safe but not re-entrant code. Notice that the code is not self modifying in any way.

http://blogs.msdn.com/b/oldnewthing/arc ... 68719.aspx

You are a reasonably good programmer if you can spot right off the bat why the code is thread safe but not re-entrant. No points if you read the explanation. Subtle bugs like this creep in if you have to write re-entrant code.
Fundamentally re-entrancy is about being able to interrupted and started again correctly. The example you quoted is a "global variable" getting modified. You will have to compile and link edit with the "re-entrant" option and that shuts out all that kind of things and forces the subroutines to be reentrant as well. The compiler will catch out these kinds of bugs and wont allow a successful compile.

There are other stuff too, like for eg, global exits (like a stop statement) wont be allowed, because that will shutdown the address space and not the task that is being executed!
Remember that I said writing thread safe code is painful, writing re-entrant code is doubly painful. I do both for a living.
I really don't see how. Between a compiler forcing good programming practice such as making sure you work with local variables, environment and global variables remaining static and not modifiable and stuff like making you exit the to CICS subsystem rather than the Kernel, and going the full nine yards of invoking and managing threads etc and all the attendant issues (including performance) if not done properly, I would think this reentrancy is easier.

I agree that there is a hell of a difference in making this reentrancy thing in a bare naked environment where these kind of rules are not built into the compiler and you have to keep that in mind and code very carefully . That would be different ball game altogether when compared to coding a bread and butter multi threaded stuff (esp in a Windoze /Unix kind of environment) I suppose. Maybe that is where you are coming from.
SaiK
BRF Oldie
Posts: 36427
Joined: 29 Oct 2003 12:31
Location: NowHere

Re: Phone, Tablet and Gizmo Thread #0x02

Post by SaiK »

anujan, that link you provided does not work for me.. i am trying to get some cics out of your discussions.
Anujan
Forum Moderator
Posts: 7900
Joined: 27 May 2007 03:55

Re: Phone, Tablet and Gizmo Thread #0x02

Post by Anujan »

Saiko The page has this:
An operation is "thread-safe" if it can be performed from multiple threads safely, even if the calls happen simultaneously on multiple threads.

An operation is re-entrant if it can be performed while the operation is already in progress (perhaps in another context). This is a stronger concept than thread-safety, because the second attempt to perform the operation can even come from within the same thread.

Consider the following function:

int length = 0;
char *s = NULL;

// Note: Since strings end with a 0, if we want to
// add a 0, we encode it as "\0", and encode a
// backslash as "\\".

// WARNING! This code is buggy - do not use!

void AddToString(int ch)
{
EnterCriticalSection(&someCriticalSection);
// +1 for the character we're about to add
// +1 for the null terminator
char *newString = realloc(s, (length+1) * sizeof(char));
if (newString) {
if (ch == '\0' || ch == '\\') {
AddToString('\\'); // escape prefix
}
newString[length++] = ch;
newString[length] = '\0';
s = newString;
}
LeaveCriticalSection(&someCriticalSection);
}
This function is thread-safe because the critical section prevents two threads from attempting to add to the string simultaneously. However, it is not re-entrant.

The internal call to AddToString occurs while the data structures are unstable. At the point of the call, execution re-enters the start of the function AddToString, but this time the attempt to realloc the memory will use a pointer (s) that is no longer valid. (It was invalidated by the call to realloc performed by the caller.)
Anujan
Forum Moderator
Posts: 7900
Joined: 27 May 2007 03:55

Re: Phone, Tablet and Gizmo Thread #0x02

Post by Anujan »

Vina-ji

I feel the re-entrancy discussion is derailing the thread. But nevertheless -- Basically invariant code is neither sufficient nor necessary for re-entrant code. Invariant code is a totally different thing, has nothing to do with re-entrancy. Self modifying code could be re-entrant. It is like saying bad programmers are a sufficient condition for making a code non-reentrant. Well yes, but bad programmers are a totally different issue. They could make a program non-re-entrant but they are neither necessary nor sufficient. Even writing to global variables does not make the code non re-entrant and falls into the same "bad programmer" argument. For example
int sum;
SUM_N(n) {
if (n <= 0) return sum;
else {
sum += n;
n--;
SUM_N(n)
}
}
Is re-entrant but writes to global variables.

Basically re-entrancy is the cousin of threading. In threading you have several threads running and you have to make sure they dont piss on each other. The way to do it is simple. Lock the shared data, dont allow two threads to access it at the same time. The OS provides local storage for threads which dont conflict with each other and everything is fine.

On the other hand re-entrancy is harder to understand. A code is re-entrant if it can execute in parallel *in the same thread* with other functions. Now what do you mean "execute in parallel" -- well Think a function Foo calls a function Bar -- they are kind of executing in parallel (even though Foo is stopped when Bar executes, it is "re-entered" after Bar stops). Now if a function A has to execute with another function B and they have to do that without pissing on each other, it is easy to think of and do. Have local variables for A and B for data that doesnt need to be shared. Have global variables for A and B only for data that needs to be shared and we are done.

On the other hand, where most Mujs make a mistake is two places (lets leave interrupts alone here, it is a whole different very complex issue)

1. A might execute in parallel with A. For example in recursive code. Thats what the example in msdn showed. Here too the principle is simple *use global variables only for data that needs to communicate* thats what the code snippet I showed you does.

2. People's concept of "global variable" is flawed. You should not think of "global variable" but "global state" instead. What if your code is like this
Function Foo() {
ReadFromDatabase()
If(condition is true) Foo()
WriteToDatabase()
}
The code uses no global variables, but might still F-up. This is because the Database is effectively a "global variable" now!! Same thing with files, network packets, calls to remote servers, HTTP requests, remote procedure calls, and the list goes on and on. Sometimes if you are using a function without knowing what it does (it might submit some data to a server and read back the results) you would be affecting global state. For example
Function Foo() {
ProcessDataX()
If(condition is true) Foo()
ProcessDataY()
}
ProcessDataX and ProcessDataY could communicate over the network to some server which adds up say X and Y -- but it is buried in some library and you didnt check what they did. But calling Foo again in the middle would cause X+X and Y+Y to happen.

Asking a compiler "to make a code re-entrant" is to tell a compiler "I wrote a pretty bad algorithm for sorting numbers, please replace it with something good". It is the holy grail of compiler technology but not possible to do in any meaningful way. In theory it sounds very appealing though.

Also, the reason I went into re-entrancy is if your complaint is that programmers screw up threading and the way to solve it is to move them to a system where they dont have to worry about threading but about re-entrancy, then it is replacing a simpler problem with a harder problem.
SaiK
BRF Oldie
Posts: 36427
Joined: 29 Oct 2003 12:31
Location: NowHere

Re: Phone, Tablet and Gizmo Thread #0x02

Post by SaiK »

Anujan wrote:An operation is re-entrant if it can be performed while the operation is already in progress (perhaps in another context). This is a stronger concept than thread-safety, because the second attempt to perform the operation can even come from within the same thread.
what do you mean by another context?
Anujan
Forum Moderator
Posts: 7900
Joined: 27 May 2007 03:55

Re: Phone, Tablet and Gizmo Thread #0x02

Post by Anujan »

SaiKo

"Context" in programming usually refers to code and the state of its surrounding data. Sometimes it is also called closure. For example if you had a class and you as

Class Foo X
X.bar()
In thread 1

And then

Class Foo X
X.bar()

In thread 2

You don't have to worry that bar() called in thread 1 if it reads members of the class will interfere with bar() called in thread 2. They are "in different contexts" even though the names and classes are the same. A simpler (but not so accurate way) of thinking about it is "different copies". Or equivalently "what variables should I save now to stop this function, go do something else and then come back and restart this function "

Similarly if a function bar() accesses local variables and then calls itself, the local variables of the second bar() will not interfere will the local variable of the first bar(). It is in a "different context"
member_20292
BRF Oldie
Posts: 2059
Joined: 11 Aug 2016 06:14

Re: Phone, Tablet and Gizmo Thread #0x02

Post by member_20292 »

Singha wrote:the 620 has a drawback of a smaller 3.8" screen vs 4.3" on all its siblings. the 720 looks smooth and sleek...I am all for it.
went into a samsung shop too - got a migraine from looking at the SAMENESS of phones from g-duos upto the S4 incl the obese 5.8 and 6.3 inch mega models /

I believe its called "SAMey" around these parts for the same reason . LOL.
SaiK
BRF Oldie
Posts: 36427
Joined: 29 Oct 2003 12:31
Location: NowHere

Re: Phone, Tablet and Gizmo Thread #0x02

Post by SaiK »

so, why would not any bar code be re-enterant? i am thinking any code can be reused/re-executed. ie., re-enter the execution lifecycle. my question is on what is re-enterant or what is not rather?

and why is re-enterant is a stronger concept than thread-safety?
Anujan
Forum Moderator
Posts: 7900
Joined: 27 May 2007 03:55

Re: Phone, Tablet and Gizmo Thread #0x02

Post by Anujan »

Basically when you write threaded code, the OS/Runtime does a few things for you. Make copies of local/global variables etc. And you do some sane things. Like have a Mutex to lock/unlock to access shared regions etc. So it is clear what you need to do for thread safety. One way of thinking about thread safety is: There are two threads Thread 1 and Thread 2 and any interleaved execution of Thread 1 and 2 gives the same result.

Okay now the issue with reentrant code is: There is parallelism where you dont expect to be: For example -- if there is a funciton bar which says

Bar() {
Wait and Lock Mutex;
Access shared variable;
Bar();
Unlock Mutex;
}

This code is thread safe (you lock/unlock Mutex for accessing shared variable. This thread wont piss on other threads). But not re-entrant. The second invocation of Bar will deadlock and will forever wait. (The mutex is locked by the first invocation, invoking Bar again, waiting for it to return, the second Bar is waiting for Mutex to be freed and will forever wait).

The issue is: Bar when executed by any other function will run just fine, but Bar when executed by itself wont run fine. The code is not re-entrant -- you cannot exit and enter back into the code. This is a toy example, re-entrancy problems can be quite complex.
SaiK
BRF Oldie
Posts: 36427
Joined: 29 Oct 2003 12:31
Location: NowHere

Re: Phone, Tablet and Gizmo Thread #0x02

Post by SaiK »

i am understanding that as being used for recursion calls. i understand the thread-safe aspects, but i can't fathom the term "re-enterant". i want you leave the mutex & thread-safe out of topic for a second and tell me, why would not any code be re-enterant? sorry to ask you this again and again.
vina
BRF Oldie
Posts: 6046
Joined: 11 May 2005 06:56
Location: Doing Nijikaran, Udharikaran and Baazarikaran to Commies and Assorted Leftists

Re: Phone, Tablet and Gizmo Thread #0x02

Post by vina »

Anujan wrote:Vina-ji

I feel the re-entrancy discussion is derailing the thread.
Yes. Interesting stuff , however, will leave the Gizmo, Phones and other Toys guys cold.

Makes me think of stuff which I haven't touched in 20 years. So let me take it to another thread . Posting in the IT, Linux and Open Source Thread on this topic.
Singha
BRF Oldie
Posts: 66589
Joined: 13 Aug 2004 19:42
Location: the grasshopper lies heavy

Re: Phone, Tablet and Gizmo Thread #0x02

Post by Singha »

the price point of qHD 4.5-5" screen, quad core cpu, android has been pulled down below 15k by micromax , xolo, karbonn , spice first and now bigger players like lenovo, zte and gionee have entered the scene with a proper back end support being put in place here. gionee is selling a really decently made phone named gpad G2 which my friend purchased...looks every inch like a twice costlier galaxy and has the specs to compete. even sangeetha mobiles have started their own badge brand named Wham.

samsung is not going to be able to hold the price like on galaxy win (17k) and galaxy grand (20k).....I think grand will retail at 15k before year is out and win for 13k, with the competitors further taking it down to 10-12K range for sure. already some are in that segment but with poor internal mem and camera - that will change...the likes of gionee are pushing in 8MP back and 2MP front cameras.
IPS screen too http://www.youtube.com/watch?v=--RGol_eWE4
Raja Bose
BRF Oldie
Posts: 19477
Joined: 18 Oct 2005 01:38

Re: Phone, Tablet and Gizmo Thread #0x02

Post by Raja Bose »

vina wrote:
Anujan wrote:Vina-ji

I feel the re-entrancy discussion is derailing the thread.
Yes. Interesting stuff , however, will leave the Gizmo, Phones and other Toys guys cold.

Makes me think of stuff which I haven't touched in 20 years. So let me take it to another thread . Posting in the IT, Linux and Open Source Thread on this topic.
What are you doing wasting your time generating hot air in ppt-giri land.....time to come back to the trenches and soil your hands doing some real stuff. :twisted: Otherwise all this chai biskoot discussion is no different than folks who flash custom roms on their Android phunwas and feel all tech-geeky :P
Singha
BRF Oldie
Posts: 66589
Joined: 13 Aug 2004 19:42
Location: the grasshopper lies heavy

Re: Phone, Tablet and Gizmo Thread #0x02

Post by Singha »

yeah we want rifle troops not "distinguished engineers" who attend only IETF/ITU/Nanog meetings and interact with "top tier management" of clients and fellow members of their tribe in other cos onlee. locally, they probably reply only to mails from directors and above :D
Raja Bose
BRF Oldie
Posts: 19477
Joined: 18 Oct 2005 01:38

Re: Phone, Tablet and Gizmo Thread #0x02

Post by Raja Bose »

Sometimes I wonder how many CS/EE engineers graduating today (MS and above) even understand the fundamentals of these principles, leave alone implement them? Based on the folks I interviewed over some years, the situation looks bleak and most of them have very little clue about what really happens under the hood. For some time now I have been toying with the idea of teaching a completely hands-on grad level class at one of the local madrassas here with no text books and only messy embedded HW, wires, mild electric shocks, and mucking with low level code running on the metal for the entire semester in an attempt to make the students really map the textbook fundamentals to the way it is realized and implemented on the ground.....clocks, strobes, interrupts, buses, memory mapped I/O, mutex, shared memory....all the very non-chi chi stuff which today's JavaScript/PHP warriors writing FB apps turn up their noses at. Those who attend the class will hate me for it becoz it will be real painful work but I feel it is essential to bring back engineering into engineering.....engineering was not meant to churn out generations of simulation toting zombies who have never touched a real system in their lives, engineering is about building real tangible things and making them work. Otherwise we will get the ranks filled with people like one worthy who couldn't even tell me what pulling a pin high or low means....he had a pee-chaddi from Stanford. :shock:
Last edited by Raja Bose on 21 Jul 2013 21:42, edited 1 time in total.
Raja Bose
BRF Oldie
Posts: 19477
Joined: 18 Oct 2005 01:38

Re: Phone, Tablet and Gizmo Thread #0x02

Post by Raja Bose »

Singha wrote:yeah we want rifle troops not "distinguished engineers" who attend only IETF/ITU/Nanog meetings and interact with "top tier management" of clients and fellow members of their tribe in other cos onlee. locally, they probably reply only to mails from directors and above :D
My boss is a distinguished engineer who behaves like a hipster, runs around giving TED talks and became a central character in one of the recent best selling novels in massa - so not the serious pocket protector equipped grizzled vet geek. However he still writes image processing code which is used by data acquisition equipment used directly or indirectly by everybody from Chacha, FruitCo, Mickey, Takla..... (of course he has little idea of what I muck around in so leaves me alone :mrgreen: )
SaiK
BRF Oldie
Posts: 36427
Joined: 29 Oct 2003 12:31
Location: NowHere

Re: Phone, Tablet and Gizmo Thread #0x02

Post by SaiK »

i was in the front line scapegoat-giri doing all that a sepoy would do.. from .303 to lmgs and sten parade and punishments. now, i am trying to save a team here, to spoil investing $1M in phase 1 rather spend extra and do the $1.5M and change the budgets.. heavy resistance from ppt-giri folks.. they only focus on allocated budget, but they don't see if any outcomes of those 1M investment be carried forward to phase-2. never believe politics can be strong when these ppt-giri folks are pounded with strong data, would like to retain their jobs by keeping to their argument zone. instead of spending a right sized projects, they think year wise. none of the branding and market slogan based investments really carries forward as useful to phase-2 and beyond.. clearly presented by data, spreadsheet, and evidence based reporting, what not. people like only ppt-giris.
Anujan
Forum Moderator
Posts: 7900
Joined: 27 May 2007 03:55

Re: Phone, Tablet and Gizmo Thread #0x02

Post by Anujan »

I am conflicted about the whole "Mujs dont know stuff" feeling. I mean every generation "doesnt know stuff" its previous generation knows.

For example, with ultrabooks and iPadwas I am sure there will be a generation of students who have never opened up a computer. I on the other hand assembled my first computer and had to put a table fan with its covers off because it used to overhead and randomly crashed. Almost every one of my friends did it -- it was a lot cheaper to assemble rather than buy it from TFTA compaq and others who had 400% markup. Nobody knows what a "partition" is these days -- I remember installing slackware linux from 14 floppies given out free by CHIP magazine. My students had never installed a OS on their machines!

OTOH my generation never set dip switches in extension cards. We had "plug and play". We never used punched cards and assembly programming was on the wane. The concept of "local variables" was more clear if you incremented the stack pointer and saved the link register before making a function call in assembly. I still remember that Penium 166MMX was the first computer that could play a Mpeg file full screen without an Mpeg decoder extension card. A year or two later, nobody would know what an Mpeg decoder extension card was. So the knowledge of the trenches is slowly disappearing. We are worse when compared to the gen before us. Same with software. Number of people who have forked and joined pthreads is dwindling. People use Hardoop and threading toolkits.

What people do is to think and deal with things at a higher level of abstraction. If it took the whole night to rip and compress a CD into mp3 (true story folks), how will you think of and build a online marketplace for digital music? If you needed to have a special extension card to decode Mpeg, how will you invent an iPad? People are dealing with a higher level of abstraction and designing and thinking of systems at a higher level. That is good for all of us.

On the other hand, what should be emphasized is a set of core concepts that are always relevant no matter how the field changes. Like Mutual exclusion in parallel programming. Rather than to think of correctness as "features provided by software" to think of correctness as semantic constrains enforced by the programmer. Ofcourse there is a tendency to add everything to the "core concepts" list, but I am sure the list can be pruned.
Vayutuvan
BRF Oldie
Posts: 13770
Joined: 20 Jun 2011 04:36

Re: Phone, Tablet and Gizmo Thread #0x02

Post by Vayutuvan »

Guys and gals who are into OS, garbage collection etc. - you know who you are. what is the status of hierarchical mutexes? Recursive mutexes? Alternately critical sections?

By the way quite a few problems go away if one engages in pure functional programming with no side effects. So no IO. closures and continuations are first class objects that can be passed around. OK granted it is good for a lot of meditation because you pose problems generate data find solutions in lambda calculus or just in terms of three operations - S K and I - Know the answer and on to next cycle of posing solving. The way to moksha - no IO no side effects no PPTgiri.

My madrassa languages group had a 200 300 level course where they used to teach the concepts of all programming languages in scheme ;) and grad students had to take the curse for extra credit and finish half a unit - we had a system of units for grad students where each unit was somewhere between 2 and 3 credits - doing a project implementing an interpreter for a language of their choice in our variant of scheme. Now a din that course number had been bumped upto 400 level and 200 and 300 level deal with more practical matters like java stuff. So nobody would recognize if a closure hits them in the face. No idea how one can do parallel programming in say pthreads if they don't know how to do currying.

(Corrected faulty recall - things have not been as diluted as I thought they were)
Last edited by Vayutuvan on 22 Jul 2013 00:11, edited 2 times in total.
Post Reply