News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Threading

Started by Astro, July 14, 2009, 08:36:46 PM

Previous topic - Next topic

Logman

Thanks Astro:

I was on the Intel website and couldn't find what I needed. Your link got me close and one more click got me what I needed.

I am attempting to use a cpu core for my main user interface while I use a second and subsequent cores to conduct parallel (additional threads) web and database searches, and file read/writes in real time in order to present the user with preemptive data to their inputs.

Logman
If you read the fine print, you'll get an education. If you don't, you'll get experience!

2-Bit Chip

;get and store the process handle

        INVOKE  GetCurrentProcess
        mov     hProc,eax

;get the original affinity masks

        INVOKE  GetProcessAffinityMask,
                eax,
                ADDR AffProc,
                ADDR AffSyst


Why is that you have eax in GetProcessAffinityMask? It is empty since you moved data (pseudo process handle) out of the register.

MichaelW

The MOV instruction moves the value of the source operand into the destination operand. Like most 2-operand instructions, it does not alter the source operand.
eschew obfuscation

Slugsnack

just a little extra info. i've forgotten what this is called but for example if you have a loop with 2 opcodes and both opcodes have no dependency on each other then they can each be executed on one core. so in this instance a single thread would have 2 cores working on it at the same time. i've forgotten the name of this though for the time being..

2-Bit Chip

I always thought of registers somewhat as the stack. You use mov--it moves data out of the source into the destination.

Slugsnack

mov would be better named as cpy really because that is what it does. copy the contents from the source operand to destination operand

there is a huge difference between stack + registers. stack is just a block of memory whereas registers are special fast-access hardware on the CPU chip

2-Bit Chip

Do registers have a maximum size?


mov eax, FFFFFFFFh
mov eax, FFFFFFFFh
mov eax, FFFFFFFFh
mov eax, FFFFFFFFh
mov eax, FFFFFFFFh


Or does it overwrite?

Farabi

Quote from: 2-Bit Chip on August 14, 2009, 09:19:09 AM
Do registers have a maximum size?


mov eax, FFFFFFFFh
mov eax, FFFFFFFFh
mov eax, FFFFFFFFh
mov eax, FFFFFFFFh
mov eax, FFFFFFFFh


Or does it overwrite?

Yes it had. Eax size is 32-bit.
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

2-Bit Chip

It had? I don't understand what you are trying to say.

Slugsnack

a register is a piece of hardware with a fixed size. the extended registers : eax, ebx, ecx, edx, esi, edi, ebp, esp, eip are all 32 bits. which means they can only hold that much. it's not like the stack where it's extendable. so if you put something in the register and then something else then the first one gets overwritten unless you specifically only write to part of that register. eg. writing to only al/ah/ax in eax, etc. then you might get 3/3/2 bytes preserved respectively

dedndave

#41
Quote;get and store the process handle

        INVOKE  GetCurrentProcess
        mov     hProc,eax

;get the original affinity masks

        INVOKE  GetProcessAffinityMask,
                eax,
                ADDR AffProc,
                ADDR AffSyst

"mov hProc,eax" copies the contents of eax to the memory labeled "hProc" for later use
the value is still in the eax register

        mov     destination,source

with most instructions, the source operand remains unaltered - only the destination changes

2-Bit Chip

Thank you, thank you, thank you! Thank you very much!

dedndave

btw, Chip
Quotemov eax, FFFFFFFFh
hexidecimal constants that begin with a letter must be preceeded by a 0
otherwise, the assembler thinks it is a label
labels, on the other hand, cannot begin with a numeric character

        mov     eax,0FFFFFFFFh