how access schedular function in linux module kernel? - module

I wanna write a linux mudule kernel that count the number of invoking schedular
I dont have any idea how I can access schedular function or any other idea for counting that
any help will be appreciate

finally i found we should find the addreess of scheduler() in system.map then count the number of reading that part of memory but how i can get prmission to access system.map and how i can count the number of reading special part of memory

Related

Is there a way to write to a file while it is being used by another process (a process in ring 0?)

Recently, I've been trying to write to a .PAK file while it is being used by another process in ring 0. This has been a problem for quite a while and i haven't had much success. I am able to use any programming language necessary to accomplish this, but C#/VB.net is preferred. I originally wanted to use a find and replace system when editing, but I will just choose and offset to write to and such instead.
No, I can't just terminate the process then edit; the process must be running. Yes, I obviously know the process with the file handle attached.
No, I can't just run as admin because the process is established in ring 0/the kernel.
I've tried multiple methods including setting the process speed temporarily to 0 to edit then revert, and changing the FileShare and other parameters, none with any success.
One approach which I have been told a lot and which I have no experience in is creating a "Kernel Driver". I'm not sure how to go about this and I cant find much info online so if you think that's is the best method please inform me on how to get started. Any help is appreciated!
Always create a temporary file (a copy of your original file). If you need to process a file within your codes, create a temp file, use the temp file and process that file. So if you need another process, there will be no problem.

Number of running processes on Minix

I looked up for similar topics on this website and could not really find a solution. The answers were always shallow and confusing for rookie like myself.
I have a task to create a C language program that will display how many processes were running on average in certain amount of time. As you can see, the stopwatch part of a program is piece of cake. The problem is I do not know how to get number of processes running.
The only condition I have is to use system calls to get the number.
While I was searching internet I found following code
struct kinfo kinfo;
int nr_tasks, nr_procs;
getsysinfo(PM_PROC_NR, SI_KINFO, &kinfo);
nr_procs = kinfo.nr_procs;
printf("Number of processes: %d", nr_procs);
When I write this code for example, I get a bunch of errors. As you can see there is plenty of undefined variables and no information about included libaries.
I could not even execute getsysinfo() function becouse I don't know how to include it in my c file.
I have to mention that program itself is working properly (I tested it with simple "hello world").
I would appreciate a little bit detailed advice on this problem since I do not have big knowledge at operative systems.

apache ode bpel expression count doesn't work

Please I need your help, I think that I have read all the threads related to apache ode, I'm either blind or stupid cause I've looked everywhere but it seems like no one has ever had a problem with count
I have an input sequence (int array) and I use a loop to do a simple addition of its content, but the count on the sequence is always returning 1. This is driving me crazy please someone help me with this
I use eclipse luna, bpel designer plugin, tomcat 8, apache ode beta 2 (because of the inline from spec initialization variables)
I don't know what details I can add here, so if I have to add more info just tell me and I'll do it
Thanks in advance
EDIT:
Thanks Walker. I tried a simple test, I just wanted to assign the count on sequence. Here is my assign :
<bpel:copy>
<bpel:from expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0">
<![CDATA[count($input.payload/tns:input)]]>
</bpel:from>
<bpel:to part="payload" variable="output">
<bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[tns:result]]></bpel:query>
</bpel:to>
</bpel:copy>

Allocating specific amount of physical memory in Visual Basic .NET?

I know this is kind of a weird question, but how do you...allocate physical memory? I know using New will make a new object but it's not allocating what I'm looking for. Here's kind of what I'm looking for: http://www.soft.tahionic.com/download-memalloc/index.html
That program allocates memory in the way I want to. How would I go about allocating around...say 500 MB? Or will VB.NET not allow this because of it's memory management? I tried googling about memorystreams and unmanagedmemorystreams but I'm not sure how to start. I also tried making large arrays but that seems kind of...unprofessional. I've only been using VB.NET for a year or so. Can someone help me get started? By the way, I just joined. Nice to meet you all!
You can allocate and free a specified block of unmanaged memory like this:
Dim handle As IntPtr = Marshal.AllocHGlobal(size)
Marshal.FreeHGlobal(handle)
See the MSDN for more info. You could alternatively use the Marshal.AllocCoTaskMem method and free it with Marshal.FreeCoTaskMem.
utilize the windows api functions such as HeapAlloc using pinvoke

Restricting Valgrind to a specific function

I have a big program to run. Using valgrind it takes hours and hours to run. I heard that there is something where we can call valgrind for a specific function in the program. And rest of program will be executed normally(without valgrind env).
Can anybody help me with this. I tried searching it over internet , May be I am missing the term to search.
It all depends on what tool you're wanting to use. For callgrind (the profiler in valgrind) there is an option --toggle-collect=function to allow you to collect information inside a particular function and all its children.
However if the tool you're interested in is memcheck (for capturing leaks / memory errors) then there is no available command line option.
Googling "valgrind profile specific function only" and go "I feel lucky"
In addition to enabling instrumentation, you must also enable event collection for the parts
of your program you are interested in. By default, event collection is enabled everywhere.
You can limit collection to a specific function by using --toggle-collect=function. This will
toggle the collection state on entering and leaving the specified functions. When this option
is in effect, the default collection state at program start is "off". Only events happening
while running inside of the given function will be collected. Recursive calls of the given
function do not trigger any action.
More here