Programming :: Processor Priority Level For Algorithm For Buffer Allocation

Jan 9, 2010

The algorithm for reading and writing disk blocks use the algorithm getblk to allocate buffers from the pool. In the algorithm getblk, if the kernel removes a buffer from the free list, it must raise the processor priority level to block out interrupts before checking the free list. Why ?Where can i find the C implementation of the above algorithm for buffer allocation in the linux source code ?

View 1 Replies


ADVERTISEMENT

Programming :: Accessing SPI From Kernel Level And User Level

Jan 6, 2009

I want to know what are the advantages and disadvantages for accessing spi(serial peripheral inerface )from kernel level and user level. like methods of doing it, speed ,memeory utilization etc

View 1 Replies View Related

Programming :: Process Memory Allocation

Apr 30, 2011

I have been assigned a school project on detecting memory leaks in linux processes. I am reading.. but have found it hard and inefficient to go through the very vast documentation not knowing what to really look for. Could you please give me some guidelines on this subject?

View 4 Replies View Related

Programming :: 32-bit Executable Getting St9bad_alloc @ 3GB Mem Allocation

Jan 13, 2010

I'm maintaining a c++ application running on a 64-bit RHEL5 server w/32GB ram, but compiled to be a 32-bit executable with g++. The application handles large amounts of data, and has lately been throwing a st9bad_alloc exception. "top" shows the application as dieing right around when VIRT=~3GB, SWAP=~1.5GB and RES=~1.5GB. In the core dump I can see that it's consistently failing to push_back() a piece of data onto a std::vector (which already has hundreds of thousands of objects in it).

I know 4GB is the maximum address space for 32-bit applications. I've learned from this lwn article that a 32-bit kernel reserves 1GB of address space, leaving 3GB for user space. However I'm not running a 32-bit kernel, so that really doesn't answer anything.I wrote a dummy app which called malloc() over and over in a for loop, and it is able to allocate right up to the 4GB before it fails. I don't understand why this one seems to be able to allocate more.

The only difference between the two apps (besides malloc vs std::vector:ush_back), is that the 3GB crashing application attaches to 512mb of shared memory.Anyone have any ideas why this application would be crashing at 3GB? Is there any more diagnostics I should be doing? I would ultimately like to port this to 64-bit for a number of reasons, but it is a big undertaking for my organization, and I'd like to better understand what's going on here.

View 3 Replies View Related

Programming :: Memory Allocation For Struct In C++?

Mar 30, 2010

How do we allocate memory of struct? what i did was

Code:

int main()
struct amp
{

[code].....

cout <<"The size of 'struct' is"<< sizeof(struct amp)<<"and it is located at"<<struct amp*s = malloc(sizeof(struct amp))<<endl;
it gives me an error---
In funtion 'int main()':
error: expected primary-expression before 'struct'
error: expected ';' before 'struct'

View 9 Replies View Related

Programming :: Implementation Of RSA Algorithm In C / C++

Aug 2, 2010

Can I know the implemention of RSA(Encryption and decryption) algorithm in C / C++.

View 1 Replies View Related

Programming :: MD5 Algorithm Implementation

Apr 27, 2011

I have a copy of the MD5 algorithm and I'm taking a look at the source. It's pretty interesting but there are a few things that I'm curious about and I was wondering if anyone a bit more intuitive than I could help me out.The function declarations in the MD5 files are a bit unfamiliar to me. There is a macro used called PROTO_LIST, which I'm still not sure as to what this thing is doing exactly, but it's littered everywhere throughout the source.The signature here isn't too unfamiliar to me with the exception of the position of the PROTO_LIST macro. So here is a function with an unnamed argument of type MD5_CTX*.To me, this resembles an initializer list found in C++ with constructors but I certainly don't think that is the case here. So my questions about this are (1) how is this legal code in C and (2) what functionality has the PROTO_LIST macro provided for the function?

View 3 Replies View Related

Programming :: Explorations In Memory Allocation In ANSI C?

Feb 8, 2011

I'm performing some explorations in terms of memory allocations in ANSI C, using the following compiler:

gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)

and I started to try to make the compiler complain for a huge data structure, so I coded this:

[code]....

I mean, I can always read the man entry for gcc but I rather ask because I can then have interaction...

View 11 Replies View Related

Programming :: Didn't Change The Original Value Of The Pointer It Was Trying To Use For Allocation?

Feb 8, 2011

A friend working in HPC environments commented me that he had an issue regarding the use of the malloc() function.What issue?He told me that he has had cases in where malloc() instead of returning a NULL pointer on failure, simply didn't change the original value of the pointer it was trying to use for allocation, thus forcing him to initialize pointers to be allocated with malloc() to NULL, so that he could be sure that if malloc() fails, a test for NULL would make sense.

View 12 Replies View Related

Programming :: Which Is Scheduling Algorithm Which Will Make Thread O?

May 4, 2011

I have a timer thread, and when it expires, it sets a flag. The only problem is, if any higher priority thread comes in between, then the timer is not expired in real time.Thus i want to set a highest priority to my thread. Now, i know 2 algos, which can make my thread in real time are: SCHED_FIFO and SCHED_RR.

So, here are my queries: 1) Which scheduling algo is best suited for this purpose? 2) Is it guaranted to work in real time if i use that algo (you suggest in 1) and set the max_priority by getting the maximum settable priority for that particular algorithm using, int sched_get_priority_max(int policy);

View 2 Replies View Related

Programming :: Algorithm For Binary Frequency Search?

Jul 16, 2010

I've got a bit of an obscure question for you to test your brains a wee bit. I'm trying to implement a search program to find areas of high density in a binary string.

E.g.

Code:

[0001001010
0001110001
0000001000
1001000010
0101100100]

Where density is the number of 1's / number of digits with a maximum number of digits being the current number in a buffer (in this example 50). So for the example the density for the whole buffer is 15/50. But the density of Buffer[14..20]=[1110001]=4/7. So if looking for areas of density = 1/3 it would find the longest sequences of density over 1/3.So in the example. Buffer[4..9]=[100101]=3/6=1/2 which is above 1/3 but it is within the Buffer[4..48]=[100101000011100010000001000100100001001011001]=15/45=1/3

View 5 Replies View Related

Programming :: Self Configurable Diagnosis Algorithm / Tcl Script?

Sep 13, 2010

I have an algorithm guys called "Self Configurable Diagnosis Algorithm" but i don't have program for this.help me regarding that program and which type of Tcl script will be better suitable for that.

View 3 Replies View Related

Programming :: Template Algorithm For Std::vector And Std::string?

Sep 8, 2010

I have two functions:

Quote:

void func1(std::string &s)
{
s.clear();
}

[code]....

Is there a way to create one template function for both vector and string that would clear them?

View 4 Replies View Related

Programming :: The Continuous Memory Allocation Is Larger 128kB For DMA Process?

Jun 3, 2010

I want to allocate the continuous memory larger 128k for DMA process. But i can't used kmalloc() function for allocate the memory larger 128KB. allocate the continuous memory larger 128k for DMA process.

View 1 Replies View Related

Programming :: Write Script To Look For The Presence Of Memory Allocation Calls Without Corresponding?

May 14, 2011

I need to write script to look for the presence of memory allocation calls without corresponding calls to free the memory

View 5 Replies View Related

Programming :: Simulate Dijsktra's Algorithm Using Network Animator Of Ns2?

May 3, 2011

I need to simulate dijsktra's algorithm using network animator of ns2. how to write a tcl script for my code. This tcl script runs the dijsktra code and simulates its running on network animator.

View 1 Replies View Related

Programming :: Algorithm For Finding The Shortest Path Between Geocoordinates?

Jun 27, 2011

AStar works on the basis of straight lines, AFAIK. In my case, we have geocoordinates and I can get the straight line distance between the waypoints. But I am wondering how approximate will the route calculated on this basis be? The actual distance "by road", which actually matters can be different.

Example. Assuming A and B are on the same plane, and will be equidistant from the goal point, if we consider a straight line between A and the goal point and, B and the goal point. The distance "by road" between A and the goal point may be greater or lesser than B. But because the AStar works on the basis of straight lines, it will return both the routes as the shortest. If yes, then which algo should be considered , if we want the results on the basis of actual distance in Km/m?

View 1 Replies View Related

Programming :: Encryption And Decryption Program In Java And Using RSA Algorithm?

Feb 25, 2011

i need a program for Encryption and Decryption using RSA algorithm in JAVA ..

View 9 Replies View Related

Programming :: Fixed Base Windowing Exponentiation Algorithm?

May 2, 2009

i try to understand this algorithm but i cann't. [URL] I encounter problem understand the algorithm of fixed base windowing exponentiation algorithm ? What is fixed base in the first place ? How this algorithm works ?

View 5 Replies View Related

General :: X: Warning; Priority Set To -1 Instead Of Requested Priority 0?

Dec 9, 2010

I have BT4 as an iso image and start it up by booting from cd, when i try the command root@bt~:startx it comes up with this fatal error. what can i do to get this work? and of course im new at this.

View 5 Replies View Related

Programming :: Algorithm - File System Block Number For Immediate Read

May 20, 2010

algorithm:breada
input: file system block number for immediate read
file system block number for asynchronous read
output:buffer containing data for immediate read {
if(first block not in cache) {
get buffer for first block
if(buffer data not valid)
initiate disk read }
if(second block not in cache) {
get buffer for second block)
if(buffer data valid) //line 1
release buffer else
initiate disk read //line 2 }
if(first block was originally in cache) //line 3 {
read first block
return buffer }
sleep (event first buffer contains valid data)
return buffer }

Here is an algorithm for block read algorithm. I have problem in
line 1: If buffer data is valid why is it releasing the buffer?
line 2: If buffer data valid why is it initiating disk read. It should have read directly from buffer?
line 3: It should be the first condition as if it is there in cache then it should return it without delay?

View 5 Replies View Related

Programming :: C Language Data Structure/ Algorithm Info Requested

Apr 2, 2010

Does anyone know of a C Language Data Structure Tutorial? I have not been able to find anything much to speak of myself.

View 4 Replies View Related

Programming :: Changing Priority Using Nice()

Oct 11, 2010

I am trying to change the priority of child using nice() but still it runs first.

Code:
#include <stdio.h>
main(){
int pid,i,retnice ;

[Code]....

View 2 Replies View Related

Programming :: Change Priority When Creating New Thread?

Feb 21, 2010

I have created an error logger thread in my application using pthread_create(), I want this thread to have a lower priority than my application's priority so that the application would run properly. Is there an easy way to do this? I know that we can change priority for thread created with policies FIFO or RR, since I don't set the policy for my application, I don't know what to set for my thread.

View 4 Replies View Related

Programming :: Need To Find Appropriate Thread Scheduling And Priority

Sep 9, 2009

I am new to thread programming. I need to generate one thread in one process using posix thread. Which scheduling and priority do i need to use? I want to generate the thread with the lowest priority. As i know there are 3 scheduling policy available SCHED_FIFO, SCHED_RR or SCHED_OTHAR.

View 1 Replies View Related

Programming :: Simulate A Serial Protocol In User Space Program To Test Reception Algorithm?

Jul 28, 2010

I want to simulate a serial protocol in user space program to test reception algorithm. The protocol is similar to UART protocol but frame format is different. The duration of 1 bit is 114,46 us. In my main function I'm creating two threads. Tx for simulating transmitting data and Rx for reception data. For measure time I use create_timer() function and signals. Each thread has its own timer and signal handler. Tx timer uses SIGUSR1 and Rx timer uses SIGUSR2. Tx thread sets the global variable and Rx reads it.

The timers are set to sample with 114,46 us period. When they reach this value signal handler should set the flag. Flag is check in thread and some operation are made. When I set the timers period for longer time (100 ms) everything works fine but when I change it to default value (114,46 us) the Rx thread doesn't receive the proper data. I am wondering if the 114,46 timer period is possible to simulate in user space? Whether the time will give me the proper resolution ? Theoretically it should provide 1 ns resolution.

View 3 Replies View Related

Programming :: Eliminate Garbage From Buffer C++

Mar 4, 2010

Code:
char retBuffer[100];
recv(sock , retBuffer ,sizeof(retBuffer) , 0);

if i send a string smaller then my buffer size retBuffer always have garbage of the end of it....what can i do to eliminate tis problem ?

View 2 Replies View Related

Programming :: Check If Buffer Is Empty In C?

Apr 12, 2011

Greetings EveryOne

how to check if buffer is empty in c?

View 14 Replies View Related

Programming :: Store A Packet In Buffer?

May 19, 2010

writing a code in C program for debugging error and sendingror messagein routingprotocols. please answer with code

View 2 Replies View Related

Programming :: Capture Packet From DMA Ring Buffer?

Jul 21, 2010

I wanna capture network packets from DMA ring buffer, just like netfilter. i wanna capture it from DMA, because i wanna get MAC address of I/O packets, so netfilter not included MAC address of out going packets because its on IP level and Ebtables is like that too. how i can capture network packets from DMA ring buffer.

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved