low-level

LC3 Assembly Square of N

梦想的初衷 提交于 2020-01-25 22:54:28
问题 Hi I'm trying to write a lc3 assembly program which computes the square of a number and stores it in r0, the integer is given as a parameter and is located in r1, the problem i noticed while debugging is during the first pass it initially adds 2, but the second pass it fails to add another 2 to r0 - My code is below any help is appreciated .orig x3FF8 ld r1,n ld r5,n square add r2,r1,#0 add r5,r5,#-1 add r0,r2,#0 brzp square brn theend theend halt n .fill #2 .end my final code thanks to the

How long does a context switch take in Linux?

坚强是说给别人听的谎言 提交于 2020-01-23 10:43:06
问题 I'm curious how many cycles it takes to change contexts in Linux. I'm specifically using an E5405 Xeon (x64), but I'd love to see how it compares to other platforms as well. 回答1: There`s a free app called LMBench written by Larry McVoy and friends. It provides a bunch of OS & HW benchmarks One of the tests is called lat_ctx and it measures contex switch latencies. Google for lmbench and check for yourself on your own HW. Its the only way to get a number meaningful to you. Gilad 回答2: Run

What's the point of cache coherency?

梦想的初衷 提交于 2020-01-22 10:59:31
问题 On CPUs like x86, which provide cache coherency, how is this useful from a practical perspective? I understand that the idea is to make memory updates done on one core immediately visible on all other cores. This is a useful property. However, one can't rely too heavily on it if not writing in assembly language, because the compiler can store variable assignments in registers and never write them to memory. This means that one must still take explicit steps to make sure that stuff done in

What's the point of cache coherency?

北城以北 提交于 2020-01-22 10:58:01
问题 On CPUs like x86, which provide cache coherency, how is this useful from a practical perspective? I understand that the idea is to make memory updates done on one core immediately visible on all other cores. This is a useful property. However, one can't rely too heavily on it if not writing in assembly language, because the compiler can store variable assignments in registers and never write them to memory. This means that one must still take explicit steps to make sure that stuff done in

Google Maps API v3 Turn Markers On Below a certain Zoom Level

白昼怎懂夜的黑 提交于 2020-01-14 14:30:47
问题 I am super green and need some help for a project. With my limited knowledge of html and javascript, I was able to make a google map with a number of locations. Here is my code (forgive me if it is bad, but it worked): <!DOCTYPE html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <title>Google Maps Multiple Markers</title> <script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript" src="https://maps.googleapis.com/maps/api/js

It is possible to write less than 1 byte to a file

耗尽温柔 提交于 2020-01-12 13:51:23
问题 As far as I know the smallest unit in C is a byte . Where does this constraint comes from? CPU? For example, how can I write a nibble or a single bit to a file? 回答1: no, you can't... files are organized in bytes, it's the smallest piece of data you can save. And, actually, that 1 byte will occupy more than 1 byte of space, in general. Depending on the OS, the system file type, etc, everything you save as a file will use at least one block. And the block's size varies according to the file

How to list first level directories only in C?

最后都变了- 提交于 2020-01-10 05:16:10
问题 In a terminal I can call ls -d */ . Now I want a c program to do that for me, like this: #include <sys/types.h> #include <sys/wait.h> #include <stdio.h> #include <unistd.h> int main( void ) { int status; char *args[] = { "/bin/ls", "-l", NULL }; if ( fork() == 0 ) execv( args[0], args ); else wait( &status ); return 0; } This will ls -l everything. However, when I am trying: char *args[] = { "/bin/ls", "-d", "*/", NULL }; I will get a runtime error: ls: */: No such file or directory 回答1:

Variable declaration performance on loops in Actionscript 3

放肆的年华 提交于 2020-01-03 12:05:50
问题 Despite all known blogs about this issue i always doubt some results and my personal tests shows that the well-said standard isn't the best. Declaring variables inside the loop, to keep them close to its scope and make it faster to be reached by the method but allocating more memory or declaring outside the for scope to save memory allocation but increase processing to iterate in a distant instance. My results shows that method B is faster(sometimes), i want to know the background around this

Are there any low-level languages that can be used in place of scripts?

我与影子孤独终老i 提交于 2020-01-01 06:36:50
问题 I am a "high-level" scripting guy. All my code is Class-based PHP or JavaScript. However, I want to know if there is any form of useful interpreter projects for "low-level" compiled languages like C or C++ (strange sounding huh?). This all came about when I stumbled upon http://g-wan.com/ and was fascinated by the fact that you could setup C code to run as server scripts. However, that project is all but useless because it is run by one guy and is closed source. So, is there anything out

How to make a bootable program?

一笑奈何 提交于 2020-01-01 03:30:10
问题 So, the question might seem strange, but let's say that I compile: int main(void) { int x = 3; int y = 4; int z = x + y; } Is it possible to make the CPU run just that? How? For example, would this allow me to write to the monitor? (If I remember it correctly, there are places in memory in which you can write stuff to be displayed.) 回答1: In the case of your program, it does not rely on any operating system services other than getting it started. If it were to additionally do input or output,