Friday, January 4, 2019

cpu - What are "Instructions per Cycle"?



I've been learning a little bit more about how processors work, but I haven't been able to find a straight answer about instructions per cycle.



For instance, I was under the impression that a four core CPU could execute four instructions per cycle, so a four core CPU running at 2Ghz would execute 8 billion operations per second. Is this the case?




I'm sure it's oversimplifying things, but if there's a guide or something else I can use to set myself straight, I'm definitely open to ideas.


Answer



The keywords you should probably look up are CISC, RISC and superscalar architecture.



CISC



In a CISC architecture (x86, 68000, VAX) one instruction is powerful, but it takes multiple cycles to process.
In older architectures the number of cycles was fixed, nowadays the number of cycles per instruction usually depends on various factors (cache hit/miss, branch prediction, etc.). There are tables to look up that stuff. Often there are also facilitates to actually measure how many cycles a certain instruction under certain circumstances takes (see performance counters).




If you are interested in the details for Intel, the Intel 64 and IA-32 Optimization Reference Manual is a very good read.



RISC



RISC (ARM, PowerPC, SPARC) architecture means usually one very simple instruction takes only a few (often only one) cycle.



Superscalar



But regardless of CISC or RISC there is the superscalar architecture.
The CPU is not processing one instruction after another but is working on many instructions simultaneously, very much like an assembly line.




The consequence is: If you simply look up the cycles for every instruction of your program and then add them all up you will end up with a number way to high. Suppose you have a single core RISC CPU. The time to process a single instruction can never be less than the time of one cycle, but the overall throughput may well be several instructions per cycle.


Thursday, January 3, 2019

windows xp - HP Deskjet D1430 "Access Denied" During Install


I put a clean copy of Windows XP Pro on a Dell computer. After updating everything, and download the latest driver install program from HP, I eagerly install the printer.


Everything is fine and all, up until step 2 of 4 in the driver and program install, I am promoted with a cryptic "Access Denied" which halts installation. I have checked the HP knowledge base, and found a tool that would correct this problem for 90% of people. Guess who is in the 10%?


So how can I install this simple printer in Windows XP, this printer worked previously on this machine, also with the same version of Windows XP, flawlessly without any issues.


And Yes I am installing this program as a System Administrator, and running the setup file as the Administrator. I shouldn't be getting these messages. Help?


Answer



Have you tried to install the driver manually through the device manager?


Universal Extractor should be able to rip the installer.


Unless someone really needs all the additional programs provided with the installer, this would be my preferred method to install HP printer/scanner drivers.


windows 10 - Computer freezing while doing any heavy task(s). Could this be hard drive failure?

I'm on Windows 10, and whenever I'm doing some heavy task i.e. playing a game, I'm encountering random freezes which sometimes go in a few moments and sometimes stay for a minute or so and the game crashes.


One thing I noticed was the HDD LED (the one that shows disk activity) stays on whenever the freezing issue occurs. Could this mean hard disk failure? Checkdisk didn't show any bad sectors or errors, the computer works like a charm but sudden freezes are a pain.


Even tried reinstalling windows(formatted the HDD too). Still no fix.

Wednesday, January 2, 2019

Automatically create a 'txt' file from a list in another txt file

I have windows 7, and little/no programming experience, I was wondering if a simple .BAT file would suffice.


I have a list of 'names' that I have to create an individual text file on an on-going basis. The files are to have no content, just simply entered into a system as the file name. The volume of files could be 2-100 each time I want to use it.


I can place all the 'names' in a separate "extract.txt" file, each on a separate line. (The 'names' are generated using excel, and appending several descriptors, and finally stored as 'text')


I then want to create an individual text file for each line in "extract.txt".


e.g. Extract.txt file contains


GKL_ERT_55555_20170807143400_1
GKL_ERT_55556_20170807143400_1
GKL_ERT_55557_20170807143400_1
GKL_ERT_55558_20170807143400_1

I want 4 text files with no content in a folder named as


GKL_ERT_55555_20170807143400_1.CTR
GKL_ERT_55556_20170807143400_1.CTR
GKL_ERT_55557_20170807143400_1.CTR
GKL_ERT_55558_20170807143400_1.CTR

how to backup EFI boot entries

I have two hard drives with Arch Linux and Windows 10 installed respectively in UEFI mode. Let's say they are disk1 and disk2. Now I want to try Hackintosh on disk2, overwriting existing windows install. Before all that, I want to make a full backup of disk2 including its EFI boot entry or maybe entire EFI boot entry table.


I have created a image of disk2 with dd under linux:


dd if=disk2 conv=sync status=progress bs=64K | gzip -c > $(date -Idate).gz

Now, how to backup EFI boot entries? I can see with efibootmgr you can only list or add boot entries. Or, do I really need to make a backup, since disk2's ESP partition is already included in the disk image?

encoding - Emacs c-mode can't recognize utf-8?

I need to read one C++ head file which has some Chinese and was encoded using utf-8.


Emacs should recognize this encoding, but it turns out:


enter image description here


Then, I changed it to text-mode, it works:


enter image description here


I also tested for python-mode, lisp-mode, etc, all works except c-mode, c++-mode, java-mode, seems there are something wrong with cc-mode, or the cc-vars?


Please help me if you know how to fix this weird problem.

sleep - How do I prevent the Windows 10 "Maintenance Activator" from waking my PC randomly (even after disabling wake timers)?

Windows 10 wakes randomly after putting it to sleep.


I have tried all proposed solutions from this old question: I have added a disable flag for the automatic maintenance in the registry, disabled the Media Center update scheduled task, disabled "wake on x" on my network adapter, disallowed scheduled maintenance tasks to wake in Security and Maintenance, and disallowed wake timers in the Power Options.


The Event Viewer lists Wake Source: Unknown for all random wake events.


After querying for wake timers I get:
enter image description here


I'm assuming this is the culprit. How do I disable it?


EDIT: This problem subsided after all the steps above, but now reoccurs for me again (presumably due to an update). I've just done the following steps that might help: First, Open the "Task Scheduler" and go into the tree as follows: Microsoft\Windows\UpdateOrchestrator\Reboot. Rightclick -> Properties -> Conditions -> Uncheck "Wake the computer to run this task". Second, change registry entry hkey_local_machine\software\Microsoft\Windows NT\CurrentVersion\WinLogon\PowerdownAfterShutdown to 1.

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...