8 ms·
A weeder question I've used: How many operations can a modern CPU perform per second: A) Thousands, B) Millions, C) Billions We'll accept C, and B with
by gilbetron 9y ago
A weeder question I've used:
How many operations can a modern CPU perform per second: A) Thousands, B) Millions, C) Billions
We'll accept C, and B with explanation. I'd say roughly 75% of the people I've asked (who have gotten through a phone interview) cannot answer it with any ability.
People whine about the difficulty of interviews, but honestly, almost everyone we've ever hired have said the interview was pretty straight forward, and nervousness is the biggest issue. Sucky people whine about reversing a linked list or finding a cycle or whatever.
- rdtsc 9y agoUsed that on college graduates. I was surprised how many couldn't answer or reason through it. Even the ones from top CS schools. I also realized how different schools emphasized computer architecture differently for CS graduates. I remember having to design a simplified PDP-11 in Computer Architecture. We had to take assembly language and such. But that was one specific college and I shouldn't assume all of them do that. Eventually I moved away from such questions and took a more collaborative approach such as "let's solve a problem together". So I'd stand beside them at a whiteboard and we think through problems. I think that puts candidates at ease and it reveals more of the skill and personality traits that were relevant for us.
- symlinkk 9y agoWhen the hell would you ever need to know that? Do you ask carpenters how many times their screwdrivers spin per minute? It just seems like useless trivia.
- adrianratnapala 9y agoWell does it take about a second or about an hour to make one turn of the screw? If a carpenter doesn't know the answer to that in his bones, he won't be fastening many things together.
- fghvbnvbnfe 9y agoIt takes significantly less than a second to turn a screw once. A couple orders of magnitude less actually, to give it some relation to the computer question. Which really just demonstrates the point, I think. At some point things are "fast enough" that it just doesn't matter. We've reached that point with computers. Unless you are working in a niche field that needs serious compute, the sources of performance problems are almost never going to arise from issues like trying to execute too many add instructions in a given period. The delays will come from things that are significantly harder to see - network, database, or program architecture + runtime.
- cr0sh 9y ago> At some point things are "fast enough" that it just doesn't matter. ...and 640K will be enough for everyone!
- moduspol 9y agoThe carpenter may simply know that turning the screw is imperceptibly instant in his experience, and that if the bookshelf isn't getting built quickly, the bottleneck is virtually never because he's waiting on screws to be turned. He's going to have to make a trip to the store anyway so he isn't concerned with whether turning the screw requires a tenth or a thousandth of a second. He's more focused on the design and craftsmanship of the bookshelf, because he's built many excellent bookshelves to industry standard effectiveness in the past and measuring the number of screws he can turn in a second hasn't been relevant to the work.
- hvidgaard 9y agoIf he is good, he can reason about it on the spot. If he can't, I very much doubt that he can design anything excellent. That requires critical thinking to understand what it is being used for, what is good, and importantly what solutions are unsuitable for the problem he is trying to solve.
- moduspol 9y ago
- mikebenfield 9y agoWhether this is a good interview question I don't know, but: > When the hell would you ever need to know that? I find this such a strange perspective. You're writing code for a computer. Sometimes you need to estimate how quickly it should run, or else estimate how quickly it could run with optimal code. Surely it's obvious that knowing how fast your computer does stuff, at least within 3 orders of magnitude, is a necessary ingredient to make that estimate. And yet in your mind that fundamental fact is "useless trivia." Very odd.
- fghvbnvbnfe 9y agoI agree that it is "useless trivia." The reason is that things today are "fast enough." These days most slowdowns aren't the result of the CPU not executing instructions fast enough. Other factors dominate, such as memory access patterns, network delays, and interfacing with other complex software such as databases. Unless you are doing compute-heavy code, the speed of the CPU isn't much of a factor in estimating how fast the program will run.
- patrec 9y agoI'm not infrequently surprised how people don't spot that something is orders of magnitude slower than it should be or pick the wrong architecture because they can't or won't do simple mental math to work out very roughly how long it should take to move some data around in memory, ssd or over the network or perform some simple computation on it. I'm having trouble believing that people who think a CPU can do thousands of instructions per second will do well at this (or reasoning about the memory hierarchy).
- fghvbnvbnfe 9y agoI don't think there's much predictive power there. The people who are answering thousands clearly just haven't though about it before and are on the spot. Humans are just terrible with big numbers, and thousands sounds like a lot already. You may as well ask any other sort of technical trivia question and figure the people that happen to carry around more random facts about tech are more likely to understand the bigger things that do matter. It isn't necessarily wrong it's a pretty obtuse way to make a judgment. Why not just ask them about the memory hierarchy or network delays or whatever directly?
- 0xbear 9y agoNo, it's more like asking a roofer how about the area he can cover with shingles per hour. Information of vital importance.
- seangrogg 9y agoLet's be real, if a roofer was asked anything comparable to a programming question it would be to provide an accurate approximation of the total number of roofing contracts completed globally within the last half-minute on the back of a coffee-stained napkin.
- 0xbear 9y agoBut that's not what's being asked by OP. Their question is rather simple, and software engineer should be able to answer it on autopilot, without even engaging her brain. As a hiring manager I would end the interview right there and then after the failure to answer something like this.
- pogaxvr 9y agoAs an interviewee, I would roll my eyes at the ignorance of the interviewer. This is the sort of question that reveals the ignorance of the person asking it. The correct answer is "yes". What is 'modern'? There are very modern embedded CPUs that operate in the low MHz range. How much power is being provided? A 'modern' CPU can be underclocked to ridiculous levels for power savings. What's an operation? Are we talking MOV AX, 1 or are we talking hashing a string? It's the kind of question a dumb person asks thinking they're being quite clever.
- taneq 9y agoYou don't, but if you found that a candidate carpenter couldn't tell you whether they could fasten 10 or 10,000 or 10,000,000 screws in a one-hour period, you'd start to doubt their ability in general.
- hvidgaard 9y agoIt's absolutely relevant. On more than one occations I've had performance issues land on my table with the developer that wrote the code saying "it's not that bad, it's going through 100.000 elements". They simply don't have a relation to how much a modern computer can do in a given timeframe. Usually I can guide them to understand where the bottleneck is, but every so often I have to rewite it so performance is acceptable.
- kevhito 9y agoNo. Here are possible carpenter equivalents, all of which I'd absolutely consider a minimum low bar... > How many nails does it take to build a house? a) hundreds b) thousands c) millions d) billions > How many rooms are in a house? a) tens b) hundreds c) thousands > How thick is a house wall? a) inches b) feet c) miles
- Terr_ 9y agoNumber of nails as analogy for CPU operations? That's not hiring a programmer, that's hiring a computer. What I mean is that -- thanks to all the programmers of yesteryear -- most programmers operate at a much higher level of abstraction when building anything that big.
- kevhito 9y agoNo. Here are possible carpenter equivalents, all of which I'd absolutely consider a minimum low bar... > How many nails does it take to build a house? a) hundreds b) thousands c) millions d) billions > How many rooms are in a house? a) tens b) hundreds c) thousands > How thick is a house wall? a) inches b) feet c) miles
- Yizahi 9y agoWhen carpenter will try to use toothed disc from circular saw on the handheld angle grinder(1) instead of abrasive disc and it will disintegrate at overspeed he'll know. Maybe it will be too late but he will, for sure. (1) because "it is faster" and "my dad always did this" and "you don't pay for my saw, so shut up"
- cr0sh 9y ago> When carpenter will try to use toothed disc from circular saw on the handheld angle grinder(1) instead of abrasive disc and it will disintegrate at overspeed he'll know. Maybe it will be too late but he will, for sure. They do make such blades for angle grinders; they tend to be "universal" blades to cut wood, metal, and ceramic/brick. There are also "chain" blades, which are meant for high-speed carving of wood (they look like a chainsaw chain wrapped around a circular blade). Likely, if you really wanted to do it and had nothing else handy, a cutoff blade would probably cut wood just fine (take care to watch for too much friction, though). Alternatively, a circle of file folder paper chucked in would work as well.
- dsacco 9y agoThat's not the correct analogy, because the carpenter uses the screw driver as a tool, not as a platform. The screwdriver is analogous to code, not the CPU. I would absolutely ask a carpenter how quickly he can complete a project, and I would hope he has a realistic first order approximation of how fast he can complete (process) screw driving tasks. That said, I disagree with the question being discussed here, because I'd rather just ask him about his speed and performance; I wouldn't ask him how fast he can screw things in :) (that's a minute detail compared to the actual work).
- gilbetron 9y agoCarpentry is far different than programming. But even so, and equivalent question I would ask a carpenter I wanted to hire would be, "How much hardwood flooring would I need to cover the rooms in my house?" If they answer, "I dunno" and then stare at me blankly, I'm certainly not going to hire them. Apparently some people take whatever warm body shows up.
- cr0sh 9y ago> Carpentry is far different than programming. But even so, and equivalent question I would ask a carpenter I wanted to hire would be, "How much hardwood flooring would I need to cover the rooms in my house?" If they answer, "I dunno" and then stare at me blankly, I'm certainly not going to hire them. It would only be valid not to hire them if they have already taken measurements and noted them down. If they can't do the calculation to convert their measurements to square footage and then to linear feet of board (with margins to allow for different board widths) - that'd be something different. Even there I would argue one could still say "I don't know", simply because you haven't specified how you want the flooring oriented per room/area (and if it goes on the bias, it gets tricky quick), or if there is any kind of special patterns or inlays you want, etc. Until you have the full specification at hand, you can't really give more than a ballpark answer, which in the case of flooring calcs could be wildly off (agile doesn't really work for real-world engineering like it can for software).
- gilbetron 9y agoAnd because of that the kinds of answer we would expect from such a carpenter in that situation is, "Hmm ... how big is the room and what size of board are you using? 2 inch, 3 inch, 5 inch, or so mix? That's pretty popular these days. How much extra do you want - I usually recommend 15% so you have some in case you need to repair." Likewise, for the original question, I'd expect some sort of discussion or nuanced answer. Something like, "Well, most modern CPUs are rated at the GHz, so on the basic level, we can say on the order of billions of operations - but we're getting a lot more cores, and given SIMD and such, you could actually go an order of magnitude or two over that, in theory. But if you are doing something that takes lots of clock cycles, it could drop down into 100s of millions, I suppose." What you don't want to hear is a deranged ranting, like some people are doing in this very thread, or "I dunno" and a blank stare.
- restalis 9y agoThe question may be to asses tech-savvy-ness of the candidate (i.e. if he/she knows the SI prefixes, what the range of the modern CPU frequencies is and how do those values reflect on computing performance). There is one kind of programmers that learned their trade just to make a buck and don't care much about their working tools, and there is another kind that finds interest in computers in general. Interviewers may prefer the second kind.
- rasen58 9y agoI feel like that's a bad question to ask. An algorithm question at least lets you attempt it and you can see if they know things. But this question isn't something that people normally talk about or think about. I think older engineers would think this is a normal question to ask since they/you have seen the evolution of computers over time, and have actually seen the number of operations changing to get into the billions. But this kind of thing may only be mentioned in one sentence in an intro computer systems course, and most young people wouldn't care about how many operations a CPU can do.
- lomereiter 9y agoThey might not care, but in that case this question essentially tests if a person understands what 'GHz' means and can think logically, which is not that much to ask.
- watwut 9y agoWhy would web programmer think about processors and GHz is beyond me. There are jobs where it might matter, but for most of them it is completely irrelevant.
- jrowley 9y agoWhen youre writing a complex SPA app and your performance is dragging on that cheap Android, it's nice to be able to reason about things like clock speed, memory usage, etc.
- deleted 9y ago[deleted]
- js2 9y agoI know we can treat a lot of the technology we use as a black box, but not knowing even the basics of that technology indicates a lack of curiosity. I'd be shocked to find a competent programmer who couldn't answer the question. A similar question: approximately how many IPv4 addresses are there? See also: "Latency Numbers Every Programmer Should Know"
- dnautics 9y agoRealistically it's a) since everyone needs to go up to the cloud and back these days.
- lurker83256 9y agoThis question is trickier than it sounds. Sure 109 clock cycles per second, but estimating for actual human-perceived ops for an algorithmic problem one should use 106. (Source: USA Computing Olympiad problems.)
- saagarjha 9y agoWould you mind explaining in a bit more detail what you mean here? I'm not quite sure where you're getting those numbers from.
- taejo 9y agoThey mean 10^9 and 10^6, and that each "operation" in a complex algorithm is often something like a hash-table lookup, which may be constant time, but takes closer to 1000 clock cycles than 1.
- gilbetron 9y agoWe totally would interview someone that responded as you did. Thing is, I'd say roughly 50% of the people that applied for the position would respond with something like "I dunno" or "A" and be unable to have any sort of rational discussion about it.
- meggar 9y agoTechnically, all three answers are correct. (A) is correct because a modern CPU CAN perform Thousands of operations per second.
- collyw 9y agoNot if it is turned off.
- kulu2002 9y agoWell...this questions seems to be OK for phone interview for entry level programmers who should know MIPS, CISC/ RISC architecture basics. I would ask such questions to fresh graduate who is supposed to be working on firmware level stuff like writing custom co-operative multitasking schedulers, OS routines, device drivers etc. Probably this type of question is not suitable for a web developers or Data analyst/ scientist