Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I guess the point is that there's no "privileged" position in these systems which changes with time, like the point of execution in programming.

What is the proper name for the bit of code that's currently being executed? I've suddenly realised that its a concept you think about constantly when coding, but its so much a part of the scenery so to speak that you never consciously consider it.



At the hardware level it's called the program counter, which is a register containing the address of the current operation the processor is running. After the operation is finished, it increments itself and moves to the next step in the program.

Edit: just realized I didn't really answer the question, I believe what your actually talking about is a statement.

I usually jump at the chance to talk about stuff from my old EE days :)


The program counter isn't the only element of that "what the program is doing now" state though. The context in which the current instruction is being executed makes a world of difference.


And the ability to save all of that into a variable so that you can pass it around to other parts of your program means that your programming language supports Continuations.


inclusive of that, the best term is probably "machine state" or similar.


I consider the "context" the scope. What is the scope in which the current statement is being executed...


On the amd64/i386 platforms, the Instruction Pointer CPU register points to the executed instruction. Its name is IP for 16-bit code, EIP (extended) for 32-bit code, or RIP (register) for 64-bit code.


Current instruction or active instruction (at the processor level)

Currrent statement or active statement at the code level


That's an interesting point.

I know that when I'm in the flow coding, there is a sort of Tick:the-program-does-this, Tock:the-program-does-that stepwise execution of the code in my head.

There are many answers as to what the hardware is actually doing with the instructions, but more generally what exactly is the name of an imaginary discrete state of a program that currently only exists in a coders head?


>but more generally what exactly is the name of an imaginary discrete state of a program that currently only exists in a coders head?

This is what I'm trying to get at. There isn't one is there? It's weird.


What is the proper name for the bit of code that's currently being executed?

I would have used 'Cursor' or 'Program Cursor'. But I'm now convincing myself that that a database term.


Top of the stack?



Program counter?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: