Jump to content

Recommended Posts

Posted

Hey guys,

naaku oka help kavali
naaku oka assignment help kavali

mee university lo elanti assignments echara ?

here is the assignment description
*****************************************************************************************
Assignment 1: Implement malloc() and free()

Implement the two functions xyzmalloc() and xyzfree(), with the same function prototypes as malloc() and free() in the standard C library. Test it enough that you are confident that they work as they should. The test code should be included in the code you hand in. The solution should include a brief description of the algorithms and data structures used and why they were chosen. The testing strategy should also be described, including reasoning of why the chosen solution was used.

Constraints

*  No headers may be included (other than your own one for declaring the xyzmalloc()/xyzfree() prototypes). That is, you are not allowed to use the system's malloc() and free() or similar.
*  You can assume a fixed amount of memory available, known at compile/link time. So use the following:#define MEM_BUFFER_SIZE 1024*1024.
*  The allocation algorithm can be as slow and inefficient as you like, it just has to work. This includes failing graciously when there's not enough memory to do an allocation (xyzmalloc() should return NULL, without undesirable side effects).
*****************************************************************************************


plz help  !q# !q#

  • Replies 32
  • Created
  • Last Reply

Top Posters In This Topic

  • krldr871

    12

  • Subbulu

    10

  • anticastepolicy

    4

  • Sneha Chowdary

    3

Top Posters In This Topic

Posted

enti okkaru kuda lera
!q# !q# !q#

entha try chesa ravatledhu !!

Posted

  sorry2 baaaa help cheddam ante naadi science group ayaeeee.... sorry2 sorry2 sorry2

Posted

[quote author=CASANOVA link=topic=79374.msg841260#msg841260 date=1278374347]
mee abbulu family vasthadi emo wait cheyi
[/quote]

hitwalltwice hitwalltwice

alaney cheyyali enka...

Posted

I can probably give you pointers on how malloc and free work in popular compilers like the gcc..
Most implementations after the C99 standard, have used the heap section for allocating memory dynamically..
Ok lets say for example there are 1000 bytes of memory in your heap..lets say 1000 is the size of your heap..
Now one way to do this is to break the 1000 bytes in to chunks of variable sizes..like 200 bytes of memory in to 20 partitions..so there will be 20 partitions of 10 bytes long..and then 300 bytes of size 30 bytes per partition..and 5 100 byte partitions..
At the beginning of each bloc you can use a pointer kind of a variable(I'm not talking about the C pointer here.) where in you can use this variable to know whether the block is free or allocated. Maintain a list of all the free blocks by just having a linked list that connects all the free blocks..when you get a request for a block of size 30 bytes, you can choose the 30 sized partition..if the required block should be 70 bytes long, you can choose one of the 100 byte block to allocate..

Posted

[quote author=krldr871 link=topic=79374.msg841266#msg841266 date=1278374596]
I can probably give you pointers on how malloc and free work in popular compilers like the gcc..
Most implementations after the C99 standard, have used the heap section for allocating memory dynamically..
Ok lets say for example there are 1000 bytes of memory in your heap..lets say 1000 is the size of your heap..
Now one way to do this is to break the 1000 bytes in to chunks of variable sizes..like 200 bytes of memory in to 20 partitions..so there will be 20 partitions of 10 bytes long..and then 300 bytes of size 30 bytes per partition..and 5 100 byte partitions..
At the beginning of each bloc you can use a pointer kind of a variable(I'm not talking about the C pointer here.) where in you can you this variable to know whether the block is free or allocated. Maintain a list of all the free blocks by just having a linked list that connects all the free blocks..when you get a request for a block of size 30 bytes, you can choose the 30 sized partition..if the required block should be 70 bytes long, you can choose one of the 100 byte block to allocate..
[/quote]

thanks mama
i know , how it works theoretically

but implementation lo problem avuthundhi.. and more over lappy format ayyindhi
so i cant compile or test my code
no comment no comment

Posted

[quote author=Subbulu link=topic=79374.msg841250#msg841250 date=1278373777]
Hey guys,

naaku oka help kavali
naaku oka assignment help kavali

mee university lo elanti assignments echara ?

here is the assignment description
*****************************************************************************************
Assignment 1: Implement malloc() and free()

Implement the two functions xyzmalloc() and xyzfree(), with the same function prototypes as malloc() and free() in the standard C library. Test it enough that you are confident that they work as they should. The test code should be included in the code you hand in. The solution should include a brief description of the algorithms and data structures used and why they were chosen. The testing strategy should also be described, including reasoning of why the chosen solution was used.

Constraints

*   No headers may be included (other than your own one for declaring the xyzmalloc()/xyzfree() prototypes). That is, you are not allowed to use the system's malloc() and free() or similar.
*   You can assume a fixed amount of memory available, known at compile/link time. So use the following:#define MEM_BUFFER_SIZE 1024*1024.
*   The allocation algorithm can be as slow and inefficient as you like, it just has to work. This includes failing graciously when there's not enough memory to do an allocation (xyzmalloc() should return NULL, without undesirable side effects).
*****************************************************************************************


plz help  !q# !q#
[/quote]baa naku telisi - ur instructor is asking you to implement the inbuilt function malloc() and free() that are available in C language. So, before you start working on this, do a background work like, what those functions are and how they work. once you can understand that better, then you shall start implementing it in your own way.

I cant give you the code,as I'm not that good at C - but I can give you the idea like what is what  sorry2

Posted

[quote author=Subbulu link=topic=79374.msg841268#msg841268 date=1278374794]
thanks mama
i know , how it works theoretically

but implementation lo problem avuthundhi.. and more over lappy format ayyindhi
so i cant compile or test my code
no comment no comment
[/quote]
check this link..this will probably help.. [url=http://www.cs.ucsb.edu/~rich/class/cs170/labs/lab1.malloc/]http://www.cs.ucsb.edu/~rich/class/cs170/labs/lab1.malloc/[/url]
you should be really good with pointers..i guess the only way to do this when you are not supposed to use malloc for initial memory allocation, is to create an unsigned char of what ever specified size..because unsigned char is 1 byte long, it will actually make it easier for you to do pointer arithmetic..
Once the array is declared, u can access the first element of the array by doing this &(array_name). Similarly next byte can be accessed by &(array_name + 1) and so on..so that way you can virtually take out chunks of spaces, allocate to requests and store them appropriately..i think for most of the things you can just memcpy so that bit by bit copy would happen

Posted

[quote author=Subbulu link=topic=79374.msg841268#msg841268 date=1278374794]
thanks[size=30pt][color=red][b] mama[/b][/color][/size]
i know , how it works theoretically

but implementation lo problem avuthundhi.. and more over lappy format ayyindhi
so i cant compile or test my code
no coment no coment
[/quote] LoL.1q LoL.1q LoL.1q LoL.1q LoL.1q LoL.1q

Posted

[quote author=krldr871 link=topic=79374.msg841272#msg841272 date=1278375094]
check this link..this will probably help.. [url=http://www.cs.ucsb.edu/~rich/class/cs170/labs/lab1.malloc/]http://www.cs.ucsb.edu/~rich/class/cs170/labs/lab1.malloc/[/url]
you should be really good with pointers..i guess the only way to do this when you are not supposed to use malloc for initial memory allocation, is to create an unsigned char of what ever specified size..because unsigned char is 1 byte long, it will actually make it easier for you to do pointer arithmetic..
Once the array is declared, u can access the first element of the array by doing this &(array_name). Similarly next byte can be accessed by &(array_name + 1) and so on..so that way you can virtually take out chunks of spaces, allocate to requests and store them appropriately..i think for most of the things you can just memcpy so that bit by bit copy would happen
[/quote] you rock  you rock  you rock buddy

Subbulu baa - this helps u alot, go through that link - and your work should be straightforward (use a bit of your creativity in getting this thing done - shouldnot be a difficult task  cheers12w )

Posted

[quote author=anticastepolicy link=topic=79374.msg841274#msg841274 date=1278375242]
you rock  you rock  you rock buddy

Subbulu baa - this helps u alot, go through that link - and your work should be straightforward
[/quote]
thankyou thankyou

Posted

[quote author=krldr871 link=topic=79374.msg841275#msg841275 date=1278375283]
thankyou thankyou
[/quote]

i will check this solution

thanks buddy
cheers12w

Posted

[quote author=Subbulu link=topic=79374.msg841277#msg841277 date=1278375572]
i will check this solution

thanks buddy
cheers12w


[/quote]
cheers12w cheers12w by the way, nuvvu ee univ mama..if you dont mind or which state r u from

Posted

[quote author=krldr871 link=topic=79374.msg841278#msg841278 date=1278375645]
cheers12w cheers12w by the way, nuvvu ee univ mama..if you dont mind or which state r u from
[/quote]

check ur pm
and thanks a ton

×
×
  • Create New...