Spacetech Posted May 3, 2008 Share Posted May 3, 2008 I would like to know if when using Run() I can specify what core the process should run on. Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted May 3, 2008 Share Posted May 3, 2008 Use _WinAPI_SetProcessAffinityMask() after the precess is started .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
Spacetech Posted May 3, 2008 Author Share Posted May 3, 2008 Use _WinAPI_SetProcessAffinityMask() after the precess is startedCan you explain to me how to use that? What should I put for iMask if theres 4 cores Link to comment Share on other sites More sharing options...
danielkza Posted May 3, 2008 Share Posted May 3, 2008 Can you explain to me how to use that? What should I put for iMask if theres 4 coresIt Works like that:each bit of the mask specifies a processor/core,starting from index 0.Example: i want cores 0 and 2,flag must be '1010' in bit notation.To achieve this,we BitOr powers of two,as they work like this: 2^0=1='1' 2^1=2='10' 2^2=4='100'.If want cores 0 and 2,then you must pass BitOR(1,4), as 2^0 = 1 And 2^2 = 4. Link to comment Share on other sites More sharing options...
Spacetech Posted May 4, 2008 Author Share Posted May 4, 2008 It Works like that:each bit of the mask specifies a processor/core,starting from index 0.Example: i want cores 0 and 2,flag must be '1010' in bit notation.To achieve this,we BitOr powers of two,as they work like this: 2^0=1='1' 2^1=2='10' 2^2=4='100'.If want cores 0 and 2,then you must pass BitOR(1,4), as 2^0 = 1 And 2^2 = 4.I'm still kind of confused with that Link to comment Share on other sites More sharing options...
ACS Posted May 5, 2008 Share Posted May 5, 2008 Alright, it's clear you've never done any programming before. The value you pass for iMask is a "mask" value that represents how you wish to set the process affinity (in layman's terms, on which cores you wish to run a process.)A mask is simply a binary representation of a value. The way it works is this: The LSB (least significant bit) of the byte represents the first core (i.e. Core #1), the next significant bit represents the next core, and so on. When a particular bit location is set to 1, it means you wish to set the affinity TRUE for this particular core, i.e. run it on this core.So you say you have 4 cores. This means that only the 4 least significant bits of the byte have any meaning.So let's say you want your process to run on cores 2 and 4. This means you're using bits 1 and 3, because remember, the LSB is bit 0 and NOT bit 1.So here's your binary number...MSB (most significant bit) --> 00001010 <-- LSB (least significant bit)If you start counting from the right, the least significant bit is Core 1, the next position is Core 2, and so on. So you see, since bits 1 and 3 are set to ones, the process will run on Cores 2 and 4.Now of course you have to convert this binary representation to either decimal or hexadecimal. Well that's easy, bit locations 1 and 3 correspond to values 2 and 8 respectively, so 2 + 8 = 10. So you would pass a value of 10 and voila, your process' affinity is now set for Cores 2 and 4.If you're confused by any of the above, I suggest you read up on binary first, since it's a very important thing to know for programmers. http://en.wikipedia.org/wiki/Binary_numeral_system Link to comment Share on other sites More sharing options...
ptrex Posted May 5, 2008 Share Posted May 5, 2008 (edited) @ACSVery nice explanation !For those of you who want to convert DEC -> HEX -> BIN and visa versa.I will drop in a converter in the example scripts section.EDIT : Converter is available -> New"]Converter @ Dec - Hex - Binregardsptrex Edited May 5, 2008 by ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
Spacetech Posted May 5, 2008 Author Share Posted May 5, 2008 Thanks. I get it now Link to comment Share on other sites More sharing options...
therms Posted June 14, 2008 Share Posted June 14, 2008 I can't quite figure out how to get a handle to a process. Any tips? Link to comment Share on other sites More sharing options...
TurionAltec Posted June 16, 2008 Share Posted June 16, 2008 I can't quite figure out how to get a handle to a process. Any tips?Would it be the PID of the process? When you use the run() function, it will return the PID of the new program:$calcpid=run("calc.exe")Then use $calcpid as the handle.If the process is already running, and you know the process name, try ProcessExists() or ProcessList() Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now