EmbeddedRelated.com
Forums

Embedded software interview question collection

Started by Unknown September 12, 2006
CBFalconer wrote:
> Say the variable is really a hardware status bit, memory mapped. > If declared volatile in the code there will be a memory access for > each read. If the hardware diverts that read to the cached value, > it will no longer reflect reality. So the system needs some means > of automatically invalidating the cache. To me, this is a primary > objection to using memory mapped i/o ports, which can easily be > avoided with a separate i/o space.
Any caching system worth its salt ought to have a mechanism to designate cacheable and non-cacheable regions. Just make sure the i/o ports are non-cacheable. Separate i/o vs memory space -- lots of cpu's only have memory space (like ppc). Not always an option. -Dave -- David Ashley http://www.xdr.com/dash Embedded linux, device drivers, system architecture
Julian Gardner wrote:

> "Yuriy K." <yktech@mail.ru> wrote in message > news:ee7uqq$268$1@news.netins.net... > >>dreamguy007@hotmail.com wrote: >> >> >>>Lately I've been assigned to interview many candidates. Sometimes it's >>>hard to ask questions that actually can reveal candidate's true >>>potential, skills, etc. >> >>I don't believe you would be able to do in during interview. Rejecting a >>bad candidate is the best thing interviewer could expect. >> >> >>>I'm trying to collect some good interview questions for embedded >>>software engineer positions >>>Can anyone contribute? Thanks! >> >>Start with the definition of "volatile". > > > Well ive been arguing with a company because they cant get to grips what > volatile really does and because of this the new piece of hardware they have > released witb an embedded processor does not work if the cache is switched > on!!!! > > I have tried for 2 years to get them to understand but they still screw the > design up. > > I now need to got through all my code and try to move every variable into a > seperate block of memory so there will be no memory corruption. >
Declaring a variable as 'volatile' wouldn't solve the cacheing problem, at least not in any of the systems I've worked on. The 'volatile' keyword will prevent the _compiler_ from caching a variable on it's own, but it won't prevent the cache from caching it -- you have to do that when you set up the MMU. For that matter, if you're having true 'volatile' declaration problems turning the cache off shouldn't fix it -- because it's a code generation issue, not a cache handling issue. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Posting from Google? See http://cfaj.freeshell.org/google/ "Applied Control Theory for Embedded Systems" came out in April. See details at http://www.wescottdesign.com/actfes/actfes.html
Tom Lucas wrote:
> <dreamguy007@hotmail.com> wrote in message > news:1158111196.188520.159910@p79g2000cwp.googlegroups.com... > > Hi all, > > > > Lately I've been assigned to interview many candidates. Sometimes > > it's > > hard to ask questions that actually can reveal candidate's true > > potential, skills, etc. > > > > I'm trying to collect some good interview questions for embedded > > software engineer positions > > Can anyone contribute? Thanks! > > I would ask what they have done outside of work that is relevent. If > someone is passionate about something then they will do it for fun as > well as when they have to.
I'm sure that question would stump many interviewees. "I my free time I ... I ... I ...? There must be some mistake. I thought this was an engineering position."
Thats one of the problems, they have no cache area, just all memory and the 
compiler also uses another instruction to access volatile.

Now when the cache is off then the two different commands work the same but 
with the cache on a non-volatile write goes to cache (no write through) but 
a volatile write bypasses the cache altogether, only when you move to a 
different cache line is it written into memory. so if you have a volatile 
variable in the middle of a block of data and you write to it then as soon 
as you read/write outside the cached area the variable gets its old value 
back.

joolz

"Tim Wescott" <tim@seemywebsite.com> wrote in message 
news:LYudnVHqOegNsZXYnZ2dnUVZ_qKdnZ2d@web-ster.com...
> Julian Gardner wrote: > >> "Yuriy K." <yktech@mail.ru> wrote in message >> news:ee7uqq$268$1@news.netins.net... >> >>>dreamguy007@hotmail.com wrote: >>> >>> >>>>Lately I've been assigned to interview many candidates. Sometimes it's >>>>hard to ask questions that actually can reveal candidate's true >>>>potential, skills, etc. >>> >>>I don't believe you would be able to do in during interview. Rejecting a >>>bad candidate is the best thing interviewer could expect. >>> >>> >>>>I'm trying to collect some good interview questions for embedded >>>>software engineer positions >>>>Can anyone contribute? Thanks! >>> >>>Start with the definition of "volatile". >> >> >> Well ive been arguing with a company because they cant get to grips what >> volatile really does and because of this the new piece of hardware they >> have released witb an embedded processor does not work if the cache is >> switched on!!!! >> >> I have tried for 2 years to get them to understand but they still screw >> the design up. >> >> I now need to got through all my code and try to move every variable into >> a seperate block of memory so there will be no memory corruption. >> > Declaring a variable as 'volatile' wouldn't solve the cacheing problem, at > least not in any of the systems I've worked on. The 'volatile' keyword > will prevent the _compiler_ from caching a variable on it's own, but it > won't prevent the cache from caching it -- you have to do that when you > set up the MMU. > > For that matter, if you're having true 'volatile' declaration problems > turning the cache off shouldn't fix it -- because it's a code generation > issue, not a cache handling issue. > > -- > > Tim Wescott > Wescott Design Services > http://www.wescottdesign.com > > Posting from Google? See http://cfaj.freeshell.org/google/ > > "Applied Control Theory for Embedded Systems" came out in April. > See details at http://www.wescottdesign.com/actfes/actfes.html
Peter wrote:

> <dreamguy007@hotmail.com> wrote in message > news:1158111196.188520.159910@p79g2000cwp.googlegroups.com... > >>Hi all, >> >>Lately I've been assigned to interview many candidates. Sometimes it's >>hard to ask questions that actually can reveal candidate's true >>potential, skills, etc. >> >>I'm trying to collect some good interview questions for embedded >>software engineer positions >>Can anyone contribute? Thanks! >> > > > Show the candidate "coax" on a sheet of paper and ask how many syllables it > has. The correct answer is of course two.
Then axe them how to pronouce "nuclear"
"Jim Stewart" <jstewart@jkmicro.com> wrote in message 
news:u_-dnTOhyYvB3pXYnZ2dnUVZ_qqdnZ2d@omsoft.com...
> Peter wrote: > >> Show the candidate "coax" on a sheet of paper and ask how many syllables >> it has. The correct answer is of course two. > > Then axe them how to pronouce "nuclear"
Or spell the word "ask" ;). Sorry, couldn't resist... Steve http://www.fivetrees.com
Steve at fivetrees wrote:
> "Jim Stewart" <jstewart@jkmicro.com> wrote in message > news:u_-dnTOhyYvB3pXYnZ2dnUVZ_qqdnZ2d@omsoft.com... > >>Peter wrote: >> >> >>>Show the candidate "coax" on a sheet of paper and ask how many syllables >>>it has. The correct answer is of course two. >> >>Then axe them how to pronouce "nuclear" > > > Or spell the word "ask" ;).
Now you're being culturally insensitive (:
"Jim Stewart" <jstewart@jkmicro.com> wrote in message 
news:Me2dnZIVeIiE2pXYnZ2dnUVZ_sednZ2d@omsoft.com...
> Steve at fivetrees wrote: >> "Jim Stewart" <jstewart@jkmicro.com> wrote in message >> news:u_-dnTOhyYvB3pXYnZ2dnUVZ_qqdnZ2d@omsoft.com... >> >>>Peter wrote: >>> >>>>Show the candidate "coax" on a sheet of paper and ask how many syllables >>>>it has. The correct answer is of course two. >>> >>>Then axe them how to pronouce "nuclear" >> >> Or spell the word "ask" ;). > > Now you're being culturally insensitive (:
LOL ;). Steve http://www.fivetrees.com
Julian Gardner wrote:
> Thats one of the problems, they have no cache area, just all memory and the > compiler also uses another instruction to access volatile.
What processor is that? I've not run into ones that have special machine instructions for volatile. Rather, the compiler mostly avoids using registers for the memory in question, so that it accesses the real location each time the variable is used.
> Now when the cache is off then the two different commands work the same but > with the cache on a non-volatile write goes to cache (no write through) but > a volatile write bypasses the cache altogether, only when you move to a > different cache line is it written into memory. so if you have a volatile > variable in the middle of a block of data and you write to it then as soon > as you read/write outside the cached area the variable gets its old value > back.
Cache is certainly an issue for the keeping things consistent, but in my experience this is not related to "volatile". Rather, the cache problem is avoided by explicitly turning off the cache where necessary. For example, if I map a hardware register to a virtual address, I tell the routine that gives me the virtual address that caching should be turned off here. Not related to the compiler like volatile is. But if there is a processor with special machine instruction to bypass cache, well, I learn something new every day... Not sure I'd want to take advantage of it though since it sounds rather unportable. Regards, Steve
Yuriy K. wrote:
> Start with the definition of "volatile".
I've confused candidates by asking about "const volatile". I don't think it's a useful question though, as it's mostly a trivia question. When I asked this I always wanted to get an impression about how the candidate thought about the problem, but it turned out that so many spent enough time being baffled by the question that they never got to the meatier issues. Some people feel strongly that candidates should know all of the subtleties of a language, but I don't think necessary in practice. I sort of get the impression that the people who do best on the trivia questions are often the bright people just out of school as opposed to the bright people with lots of experience. So I tend to ask things that indicate how much actual practical experience they've had. Ie, say "give me an example of how you've used this". -- Darin Johnson