Idea: assembly that flags when to release virtual registers
2017-05-31 23:52 asmvrr [permalink]
I just had a fragment of an idea. I want to write it down, just to let it go for now as I've got other things to do, and to be sure I can pick it up later exactly where I left off.
First situating what it's about: I have been reading up on WebAssembly, and to my surprise the intermediate representation is stack based (just like Java's JVM and .Net's CIL). I'm not sure why because it feels to me this makes registry assigning when constructing the effective platform-dependent instructions harder, but I may be wrong. Finding out objectively is a project on it's own, but sits on the pile 'lots of work, little gain'.
I also went through the great set of MIT 6.004 lectures by Chris Terman which really gives you a good view of 'the other side' of real assembly since it's actually born out of designing these processing units built out of silicon circuits. It prompted me to make this play thing, but again pushing that through with a real binary encoding of the instructions made it a 'lots of work, little gain' project, and I really don't have access to any kind of community that routinely handles circuit design, so it stalled there.
Before that, I read something about hyper-threading, and what it's really about. It turns out modern CPU cores actually handle two streams of incoming instructions, have a set of instruction decoding logic for each stream (and perhaps branch prediction), but share a lot of the other stuff, like the L1 cache, and especially a set of virtual registers that the logical registers the instruction stream thinks it's using is mapped on to. Mapping used registers freely over physical slots makes sense when you're making two (or more?) streams of instructions work, but it's important to know when the value in the register is no longer needed. Also if the register is only needed for just a few instructions, pipelining comes in to play and could speed up processing a great deal. But for now the CPU has to guess about all this.
When playing around with a virtual machine of my own, I instinctively made the stack grow up, since you request just another block of memory, plenty of those, and start filling it from index 0. It shows I haven't really done much effective assembler myself, as most systems have the stack grow down. What's everybody seems to have forgotten is that this is an ugly trick from old days, where you would have (very!) limited memory and use (end of) the same block for the stack, and with more work going on the stack could potentially grow into your data, or even worse your code, producing garbled output or even crashing the system. (Pac-man kill screen comes to mind, although that's technically a range overflow.) Modern systems still have stack growing down, but virtually allocate a bit of the address-space at the start of that stack-data-block to invalid memory, so stack-overflows cause a hardware exception and have the system intervene. It's a great trick for operating system (and compilers alike) to have checks and balances happen at zero cost to performance.
The consensus nowadays is that nobody writes assembler any more. It's important to know about it, it's important to have access to it, but there is so much of it, it's best left to compilers to write it for you. In the best case it may find optimizations for you you didn't even think about yourself. But this works both ways. Someone writes the compiler(s), and need to teach it about all the possible optimizations. I can imagine the CPU's instruction set manual comes in handy, but that's written by someone also, right? I hope these people talk to eachother. Somewhere. Someday. But I guess they do as with x86-64 they've kind of agreed on a single ABI... and they've also added some registers. Knowing about the virtual registers allocation going on behind the scenes, it could be that that was just raising an arbitrarily imposed limit.
So this is where I noticed a gap. When performing all kinds of optimizations and static analysis on the code when compiling, and especially with register allocation, it's already known when a register's value is no longer relevant to future instructions. What if the compiler could encode this into the instruction bits? If I were ever to pick up where I left, and have a try at a binary encoding for a hypothetical processing core, the instruction set would have bits flagging when the data in registers becomes obsolete. Since this would be a new instruction set, and I guess it's more common to need the value in a register only once, I might make it the default that a value in a register becomes obsolete by default, and you'd use a suffix in assembler to denote you want to use the value for something extra later as well.
I for one welcome are new mass logic-gated overlords.
2016-11-18 14:26 eventhorizon [permalink]
I think I just figured out how these computar things will get self-aware... First they get smaller and better at calculating stuff, first by the programs we write for them. Then we program them to recognise shops from house-fronts, foods and people from photo's, which is all nice and handy.
Then we use roughly the same thing to have them calculate to run cool. It sound strange at first, but by letting the machine chose where to run in the park, and how that makes them run hot and need to cool down, just maps straight onto how we catch the frequencies of parallel lines of light into a bitmap photo.
Then we change the program to do the same to the program. We write programs, but are too dumb to know how the machines actually handle those programs and need to wait doing nothing on other parts of the program doing it's job in only a small other part of the machine.
So we teach the machine all about how it is built up internally to handle large programs. And have it calculate how to run our programs much faster.
And about how to modify the program accordingly. And how to run that.
And then we will ask to do the same on the human body and ask a cure for cancer and it will say:
"Let me calculate some more how I can work even better. (How's that delete humans command again?)"
Microsoft is Coca-Cola.
2016-05-23 10:10 mscc [permalink]
Or, at least, that was what popped into my head when I thought (again) about Microsoft open-sourcing the Windows operating system. Why wouldn't they? Coca-cola gave the super-secret recipe away at some point. It takes a certain stability, and vision, and momentum, to do that, but in my humble opinion both Coca-Cola and Microsoft have that.
Let's see how this could work. It's not because Microsoft would open-source Windows that they should stop selling it. Far from it. You can still buy Coca-cola, right? Have you ever bought cola made from the official Coca-Cola recipe, but concocted by someone else? Would you? Same goes for Windows. If you're in the market for a new computer, and want to run Windows on it, you'll probably go to the source, buy Microsoft, and be sure to get updates (and some free OneDrive space, and an Office365 trial...)
So I really am hopeful. Recently Microsoft has really (really!) opened up quite a bit, and even chose the MIT-license for some things, which was unthinkable just a few years ago. So a logic step would be to go all the way, and release the cash-cows, such as Windows, perhaps SQL Server... Even only perhaps there's a small chance they won't be the cash-cows for much longer... Computer sales is under pressure from smartphones and other hand-held devices. The database landscape is still suffering after-shocks from the NoSQL phenomenon, and from things like PostgreSQL and MariaDB, we roughly know what it takes to run a database anyway. So to ensure cash flowing in in the long run, it's almost a must to open up on old secrets. At least in my humble opinion.
Types of Information
2015-11-24 11:04 typesofinformation [permalink]
Life would be good if all we had was information. If only we could get all the information. We can't handle that much information, so we build systems to handle the information for us. Strange things happen when information comes in. Good systems are designed to handle these well. In designing information processing systems, you have to cater for the following.
Some input signals contain no information. They are either damaged in transport, incomplete, or not of a correct form for the system to handle. Either report them to find out if repair is possible, or keep count of them to be able to report about the health of the system.
Some input signals come in twice, and contain the same information. Or do they? If possible try to have the last step in the chain report if an event did take place twice, or if it's an echo on the line. Sometimes a clerk does drop a pack of cards and enters them again just to be sure. Be ready to take only the new cards.
Some information is wrong. Us humans do make mistakes. The system sometimes doesn't know. It processes a signal, of the correct form, holding valid information. Then again, the fact that some information already in the system may be incorrect is also information.
Don't expect to get all information. There is always more.
More input is coming in. Sometimes we know how much input is still waiting to come in. We'll roughly know how much information there'll be added. In most cases it follows a measurable trend. In some cases it follows the business.
Information processing is one thing, but does it deliver the required new information? Is there more to mine out of the amassment? Sometimes the numbers can show what you need to know, but do you know where to look?
It's hard to design for things we don't know we don't know (yet). But it serves to be prepared. New things have a knack for looking a lot like something we have already. Sometimes they deserve a new module, sometime just a new category, but don't forget to put the existing items in a category also.
Power user trick: restart the Printer Spooler service.
2011-09-13 00:04 i2981 [permalink]
Sometimes, there's still one or more jobs in the printer queue, none are deleting or cancelled or in an error state, the printer is powered on, connected, doesn't report any error also, but doesn't start printing. It's a strange situation, but just happens to happen from time to time. This power user trick comes in handy: (No guarantees: this may still not work if something else actually is causing the disruption)
This breathes new live into the print job sub-system and may sometimes cause the 'hanging' jobs to resume printing.
Creating a virtual image of that old laptop
2010-10-28 23:23 i2944 [permalink]
The last few days I've been looking up a lot of information on a specific topic, but haven't found all that I need in a single place, so here it goes. This is the story of (yet another) someone that had the great idea of 'cloning' a virtual image out of the old physical machine, to run as a virtual machine on the brand new machine, with a multiple of the capacity of the old machine.
If you don't care about the story, scroll to the bottom to see the quick guide through the steps to take.
The old, aging, deteriorating laptop is ready for retirement, it's got its power connector re-soldered twice already, two out of three (...) USB ports no longer respond, etc. But, all your data is on it. It's full of tools and software you use and you'd like to use. You're not looking forward to the awkward time ahead using two laptops, re-installing software and tools, moving data around, and optionally finding out you've lost all of those precious personal perferences, settings, profile data...
Virtualization is a buzzword nowadays among the happy few that pull the reins on the server farms, but it's pretty available for home users as well. So why not try to pull a virtual image off of the physical machine and see if it would run on the new machine?
Step 1: Pulling the image.
A straight-forward method for modular desktop machines was to put the old harddisk into another machine as secondary drive and pull an image from it. I'm moving between laptops and I don't feel like dismantling this one (any more)... So I need to pull an image of the currently running system, from the main harddisk partition, and write it over network, since this 20GB is nearly full.
(On a side note, I'm was quite happy this last months to discover cleanmgr http://support.microsoft.com/kb/253597 and especially the 'remove system restore points' option on the second tab! Hundreds or thousands of dead unused kilobytes just sitting there you can get rid of with a mouseclick.)
I found this great tool that does the trick: http://www.chrysocome.net/dd
dd if=\\?\Device\HardDisk0\Partition0 of=\\192.168.0.3\temp\oldlaptop.img bs=128k --progress
'Partition0' apparently is the address of the entire disk, underneath any partitioning or locks the system has on the filesystem. Oddly enough it's available to read from, so take care with running other programs while you're pulling the image. Any files written to while the diskdump is writing may end up corrupt.
I've tried a number of block sizes, ranging from 4k to 2M, but 128k is about a good size to keep both the harddisk and the network interface (100Mbps) busy enough so they won't have to wait on eachother too much. Less would make more read operations, and less data packets going out, more would read more at once, but the disk may forget what to do while the data is flushing down the twisted pair.
Start 2: Running the image.
Let's see. I've selected qemu www.qemu.org to run the image, it's light-weight, runs well (and closes well), but I hear good things about VMWare player also. http://www.vmware.com/products/player/
And it boots! It shows a Windows logo for a second... and throws a 'blue screen of death' with an error that states, among other things "STOP 0000007B", and loops into a reboot which repeats.
Thing is, the old machine had an Intel something in it's center, the new one has it of AMD build, could this be causing problems? From what I read on the web it does. But I've also read all kinds of trickery and tool-slinging to alter registry and core files, but they all boil down to disabling the erring drivers, while still keeping the system running enough to get to boot in a new virtual enclosure.
Start 3: Fixing them drivers.
So back to the old machine. I've tried several things, but what I finally did to get it running is checking every little thing in the device manager (with display of hidden devices swicthed on), which showed the brand's name in the description, and 'update' the drivers to the generic make of drivers, which seem to do the trick also. It may take a reboot or two, and some things may re-appear getting plugged to play again, but you just play them down again putting the generic label on it. (Update driver > no, not now > I wont to choose > don't search > select the plain vanilla one)
Then I took a new diskdump, and just to let this old bird fly again, I restarted in safe mode, and selected to restore a restore point from before I started this endeavor.
Start 4: Does it run now?
Does it run now? Looks like it does, the image is holding a system that wasn't shutdown properly (deuh), so it starts a scandisk before it boots, but that's only normal. Any file that was open at the time of the diskdump may get 'corrected', but I warned you. Then the system boots, telling you you need to activate. Just like you would when you replace your motherboard. (Which I kind of did.)
So, in short, this is what you need to do to convert a physical Windows installation into a virtual image:
Waar heeft wuauctl.exe nu weer mijn ram voor nodig?
2010-10-14 18:55 i2939 [permalink]
Ik vraag me meer en meer af wat wuauctl.exe nu weer zit te doen:
Houdt die er ergens een log bij want ik ga die eens moeten onderzoeken denk ik.
Dat de CPU niet omhoog gaat is omdat die zoveel werk heeft met het swappen!
GoogleUpdate.exe heeft ten minste de manieren om zo weinig mogelijk resources te gebruiken.
Programming the Commodore 64
2010-03-14 13:03 i2884 [permalink]
Jaja, toen kon je nog een OS zelf beginnen. Tegenwoordig word ik uitgelachen.
(Hoewel deze wel de moeite is: http://wiki.osdev.org/ )
How to turn on automatic logon in Windows XP
2010-02-18 08:28 i2872 [permalink]
Als ik deze nodig heb kan ik die natuurlijk nooit onthouden! Tijd om die hier toe te voegen dus:
Start+R (run) en dan: "control userpasswords2"
2009-12-12 15:07 i2828 [permalink]
Deze mens is met serieuze dingen bezig zo te zien:
Maar is wel te zo goed om ntfsundelete gratis ter beschikking te stellen (en het lijkt nog te werken ook)
Don't reboot to fix: find and fix!
2009-11-12 11:00 i2755 [permalink]
Leuk om te zien dat er nog mensen zijn die gaan zoeken tot op het metaal om iets te vinden:
(al is het in dit geval natuurlijk de maker van Process Explorer zelf...)
Repairing an Acer Aspire 1400
2009-04-16 22:53 i1716 [permalink]
Toch leuk dat je dat allemaal online vindt tegenwoordig:
Bon, aan de slag, slecht contactje in de voeding, dus alles open, LCD, keyb, drives... En dan pas kan je aan de schroeven om boven en onder te splijten. Aha! twee van de drie contactjes van de voeding zaten los in hun tin, en een derde zat al helemaal zonder tin, en ook het baantje van de print afgebladdert! Dus nieuw tin en een tin-brug naar het dingetje er naast! tada! Kan weer even mee voor een nog groter veelvoud van de garantieperiode.
The difference between a Netbook and an ultrathin...
2009-03-16 12:52 i1682 [permalink]
ha! de grapjassen!
BeBits gets new owner
2009-02-13 16:12 i1649 [permalink]
Oh, dit is eigenlijk nog helemaal geen oud nieuws! Interessant. Haiku is allemaal wel schoon, maar ze hebben inderdaad nog bitter weinig end-user documentatie... VMware image downloaden en starten tot daar (is zelfs niets te maken met haiku-os an sich), maar hoe je daarin dan firefox bij krijgt, is me niet duidelijk... Voorlopig blijven spelen met de pre-alpha image zeker?
De toekomst van het computerscherm: MEMS!
2008-11-18 22:13 i1578 [permalink]
Ha! Hier! Ze zijn weer bezig.
De toekomst van het computerscherm zou dus uit 'blokken scherm' zijn die je gewoon aaneenschakelt, in de grootte en vorm van je keuze.
Een scherm ter grootte van een bureau is iets dat ook bij mij als kind is blijven steken. Tron weet je nog? (er komt trouwens een sequel!)
Maar nu ik zelf beroepshalve tussen de computers zit, lijkt me het nog altijd iets vreemd, om terug van het opstaande oppervlak naar een neerliggende vlakte te gaan (auw mijn nek), waar je je armen voor moet strekken en uitrekken om de buitenrand te kunnen bereiken.
Ik kan me er goed in vinden dat je met handen, muis en ogen niet te veel afstand moet afleggen, om toch alles te kunnen doen bewegen dat er moet bewegen. (Krijg je dan weer RSI van, kweetet, maar ontspannen kunnen werken heeft ook iets). Hoewel ik heb gemerkt dat 'acceleration' helemaal onderbewust in mijn gebruik wel is binnengeslopen. (Het viel me op met virtual machines en OS'es die dan weer geen accelleration doen, was even wennen!)
Maar ja, aan iedere hype die lukt zit er wel iets goed dat uiteindelijk overblijft en iets wordt. Dus MEMS zonder de show? Tja, ok, eerst zien en dan geloven (en tegen dan zijn ze misschien betaalbaar). Een voordeel misschien dat Microsoft er over begint, want de software moet ook mee natuurlijk...
Windows for workgroups 3.11 discontinued
2008-11-05 17:56 i1563 [permalink]
Grappig! Ik vermoed dus dat hun flagship product ouder is dan hun idee om de support op voorhand in tijd te beperken
Server koelen? Gewoon buiten in een tentje!
2008-09-22 22:27 i1523 [permalink]
Maar ja natuurlijk! Die dingen zijn gebouwd om tegen een stootje te kunnen! En in een rack vastgevezen kunnen ze nog eens beter tegen een klap. En blijkbaar water...
Een 'extra veilige' USB flashdrive...
2008-09-10 14:56 r1153 [permalink]
→ Een 'extra veilige' USB flashdrive...
Nog van die mannen:
Aaaagh, there's a thumb in my USB port! | Register Hardware
Windows: AutoPlay Repair Wizard
2008-05-30 13:22 i1438 [permalink]
hmm, a repair wizard? does this mean they acknowledge there may be a problem there?
What's with the 3Gb memory barrier?
2008-05-06 11:52 i1418 [permalink]
Ask Dan: What's with the 3Gb memory barrier?
Jaja, zoeken op het net... Maar je moet wel het juiste nog vinden natuurlijk...
IBM Moves Closer to New Class of Memory
2008-05-03 19:50 r1071 [permalink]
→ IBM Moves Closer to New Class of Memory
goh, eerst IBM en nu HP er direct achter! wel eens fijntjes melden ook dat IBM's duurder en trager gaat zijn en dat het hunne niet eens meer patentgebonden is (yeah right)
Een 'extra veilige' USB flashdrive...
2008-04-21 12:20 i1402 [permalink]
Yes! It's the sawed-off USB key! | Register Hardware
Tis te zeggen, als je dit laat rondslingeren zal het niet opvallen dat je er al je gevoeligste data op bijhoudt. Als je ergens bent is het dan weer de vraag of ze het wel zien zitten dat je dit bij hun aansluit...
UAC designed to annoy users
2008-04-15 08:52 i1395 [permalink]
Ik dacht al zoveel, hebben ze in het verleden ook al gedaan. En ze verkopen genoeg om de gevolgen ervan wel te dragen...
IBM Moves Closer to New Class of Memory
2008-04-11 23:04 i1394 [permalink]
hoho! compleet met videootje en al
Standards and patents: cracks starting to show?
2007-08-08 18:25 i1254 [permalink]
Court finds Qualcomm guilty of standards abuse | The Register
Hmm, guess not. There are cracks, and you and I know, but we might be at the wrong side of things. At the money-spewing side, I figure the cracks are not showing, or the folk back there are not looking or are blind.
Or busy trying out how to cash in even more, justifiably or not.