14
votes
Accepted
Is a call stack required for robust computer architecture?
... which makes me wonder if there are any systems / architectures for defining a virtual machine without a call stack
Continuation Passing Style enables tail call optimization for all function ...
11
votes
How are "registers" implemented in VMs?
JVM and .NET both employ "JIT"'s.
These JITs take their respective byte code (both stack-based) and translate them into machine code for the processor they're on. Thus, the same hardware that ...
11
votes
Why are most language virtual machines designed with a load/store architecture? Is there a speed advantage vs. a register-memory architecture?
There are a variety of VMs, including VMs that use “registers”. However, the point of the VM is that it abstracts over physical machines so the VM will likely not limit the number of registers! Such ...
10
votes
Accepted
Why is it difficult to create a truly portable garbage collector for C?
Garbage collection requires the possibility to find objects in memory that are no longer used. One way of doing it is to have a marking algorithm that goes through all the active references. Another ...
6
votes
Why are most language virtual machines designed with a load/store architecture? Is there a speed advantage vs. a register-memory architecture?
The idea is that the code for your virtual machine is not interpreted, but compiled at runtime into machine code for the real machine.
A register/memory approach makes it harder to translate into ...
6
votes
Accepted
GCC or Clang to output bytecode for a VM?
I would strongly advocate for LLVM.
LLVM is the future, and IMHO is favorable for new compiler implementations compared to GCC.
Here's why:
Modularity:
LLVM is a modular compiler framework, much ...
6
votes
What is the best way to run untrusted hooks/plugins?
If you do not trust the code, do not execute it - period.
If you wish to trust the code.
Constrain what is permitted as code
reject specific operations such as eval(...)
reject unbounded loops
reject ...
6
votes
Accepted
To show the difference between system VMs and JVMs
It's fine as is, if you think about it the right way.
You can think of a Virtual Machine as a task running on the hypervisor. They get context switched nearly the same way after all. Tasks and Apps ...
6
votes
Accepted
Use of globals in stack-based virtual machine implementation
Usage of globals is a matter of scope of the program "around" them.
If this "stack-based virtual machine" is the whole program, and the statement "...variables are used by ...
5
votes
Accepted
Why do we need nginx server on top of linux server?
Very roughly: A Linux system speaks UNIX. It gives you the ability to run UNIX programs by offering the syscalls open(), malloc(), socket() etc. etc.
A web server like nginx speaks HTTP - it ...
5
votes
Accepted
How should a bytecode VM call external C functions?
Exactly, you can obtain function pointers via dlsym() and then call them – but how to perform the call depends on the function's calling convention. In theory you could write some assembly to bridge ...
4
votes
Help With Memory Mapped I/O and Hardware Interrupts for Virtual Machine
The part I'm not sure about is exactly how interrupts work and how I can have my processor jump in the middle of an instruction to deal with an interrupt.
The basic idea you already have is that the ...
4
votes
Accepted
What is the minimum set of operations a language implementation must provide for it to be usable for all applications?
Step 1: determine which platform/operating system you are targetting.
Step 2: offer access to the full capabilities of that platform.
For example:
If you are developing a language that is supposed ...
4
votes
Accepted
Is there any reason I shouldn't use a LInux host for a Linux guest VM?
Using a Linux-on-Linux virtual machine is perfectly fine and can make sense for better configuration management.
For example, you can keep a fairly stable, lean, and secure host system like Debian and ...
3
votes
Accepted
How is an async stack implemented?
If I understand correctly, you are trying to implement fibers in JavaScript. If I am wrong, then you just need to look how the JavaScript event loop works. Instead of fibers, you can have promises.
As ...
3
votes
Is a call stack required for robust computer architecture?
I do not think robustness is an issue here. Functionality is, in the most literal sense.
Forget implementation details for a moment and consider what a call stack is, really. It allows you to call ...
3
votes
Accepted
Why do some VMs manage their own memory instead of relying fully on the system allocator?
One reason is that applications, being higher level, know their requirements better than the underlying system. For example, if the application is doing garbage collection, that benefits greatly ...
3
votes
Accepted
What is the best way to run untrusted hooks/plugins?
Python has no security model that would allow you to safely execute untrusted code. If you want to execute untrusted Python code you need to apply operating system level safety measures, for example ...
3
votes
GCC or Clang to output bytecode for a VM?
Between GCC and LLVM, I'd suggested looking at LLVM first. GCC is apparently known to be cumbersome to develop, whereas some of LLVM's code was specifically written in reaction to that very same ...
3
votes
Accepted
How can I access attached data section in custom script language?
Plain bytes don't carry any types. Instead, the operations on these bytes impose an interpretation of this data. Most instruction sets have different instructions for performing the same operation but ...
3
votes
Virtualization vs Container
The question is no longer accurate. Today containerization as defined by the Open Container Initiative (which includes Docker) is a means of hosting complex applications as if they were individual ...
3
votes
How to model opcodes effectively for a language VM?
Practical instruction sets tend to use variable length instructions, which has a number of advantageous consequences:
You can include immediate values directly with the instructions, without having ...
2
votes
How do interpreters and VM print?
I would like to take Python as an example. In CPython we have a print statement represented by PRINT_ITEM VM instruction. Then we have a print() function which (sic!) I believe calls directly or not ...
2
votes
How does a stack VM manage with only one stack?
Why:
Because it's simple & efficient.
When you have only one stack, you don't have to do anything for your stack memory management. All the things you have to do is allocate one big chunk of ...
2
votes
Accepted
Sharing virtual box / environment?
There is no need for a “cloud” environment at all. Every developer should have their own development environment. This may be local or on a server, and this may or may not be a virtual machine. The ...
2
votes
Is comparing "dollar-hours" for running a specific piece of code practical as an estimate of rented system performance?
Yes, but they are called dollars, not dollar-hours. You are not multiplying cents and minutes; you are multiplying cents per hour, and minutes. The time units cancel out and give you cents. 7.5 ...
2
votes
Accepted
OS tax in dockerized production environment
It doesn't sound to me like the quoted bit isn't saying "4 instances of the same application", rather it's "4 different applications". But the question of why you might want to run multiple copies of ...
2
votes
How can one bake a GUI framework inside an interpreter without freezing the interpreter?
once you call the C function g_application_run, the thread enters an endless listening loop inside GTK.
That is only part of what happens. What you have to do here first is to register callbacks for ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
virtual-machine × 121interpreters × 13
virtualization × 12
programming-languages × 10
compiler × 9
c × 7
jvm × 7
bytecode × 7
java × 6
language-design × 6
architecture × 5
licensing × 5
memory × 5
linux × 5
development-environment × 5
garbage-collection × 5
low-level × 5
c++ × 4
python × 4
.net × 4
windows × 4
operating-systems × 4
assembly × 4
design × 3
web-development × 3