What are the minimum requirements to get a job in?

Christian Heimes christian at python.org
Fri Dec 14 06:42:27 EST 2012


Am 14.12.2012 04:25, schrieb Greg Donald:
> On Thu, Dec 13, 2012 at 8:49 PM,  <suresh.pinnapa at gmail.com> wrote:
>> My aim is to get a job into google or cisco or facebok.
> 
> I made it to the 4th interview with Google.  When they say they want a
> "developer" they really mean they want a developer/sysadmin/kernel
> hacker/c/c++ guru.  I nailed all the Python questions in interviews #2
> and #3, but then at interview #4 they started asking inode questions,
> how to implement a compiler, how to design my own version of
> memcopy(), etc.  It didn't really matter to them that I had 2M
> downloads on Google Play, or that I knew Ruby, Rails, Python, Django,
> PHP, iOS and Java..  I didn't know how to move 2GBs of memory from
> here to there without using memcopy(), so that was that :(

Oh, that really hurts. :( I guess, you got your hopes up, when you made
it through interview #2 and #3 with flaming blazes. On the other hand
you are now aware of your shortcomings and can learn about it for your
next interview.

To be fair, memcpy() is a pretty simple function. It can be implemented
in just about two lines of C code plus five lines of boiler plate. It
shows, if you have very basic understanding about memory layout and
pointer arithmetics.

You have to translate something like

def memcpy(dest, src, n):
    for i in xrange(n):
        dest[i] = src[i]

into C code. Here is a rather nonperformance solution. It copies just
one byte per cycle. A better implementation could copy 4 or 8 bytes at
once and handle the tail in a switch statement.

void *memcpy(void *dest, const void *src, size_t n)
{
    char *destptr = (char*)dest;
    char *srcptr = (char*)src;
    while (n--) {
       *destptr++ = *srcptr++;
    }
    return dest;
}

destptr and srcptr are the memory addresses of a byte (char). *destptr
is the value at a specific memory location. The code in the loop copies
the value at address srcptr to the location at destptr and then moves
both pointers one step to the right (++). That's all. ;)

Christian



More information about the Python-list mailing list