Linux C/C++ 作业辅导

A multithreaded malloc

A multithreaded malloc

1 Introduction
Your task in this assignment is to implement a multithreaded malloc i.e. we
should be able to use it in a multithreaded application. The basic require-
ment is of course that it is thread safe, that it still works even if two threads
us it at the same time. This is of course very easy to solve by having one
central lock that protects any data structures that are used by the module.
It is a bit harder to allow multiple threads to actually use the malloc module

C++ Assignemnt


C++ Assignemnt


Use a Linked List and a set of Derived Classes from a Base Class to demonstrate polymorphism in C++. To do so, alter linked-list source code to run a family of mobile phone derived classes, and create a menu to demonstrate the functionality.  Students are allowed  to work in groups or cohorts. For ease of submission, please e-mail the instructor the members of your cohort before the due date.


The Linked List


Sample code is available to create a linked list on Blackboard.  Alter this code to create a linked list capable of handling the derivation tree of a series of mobile phones. The base class is mobile phone.


The linked list must be an independent class, and must have the following data and functions:

  • MobilePhone * head – a pointer to the first location in the linked list.
  • MobilePhone * tail – a pointer to the last location in the linked l

C++ Basic

C++ Basic
The first assignment is intended to reacquaint you with C++, your programming environment, and software design.
If you are familiar with C++ this assignment (both parts 1 and 2) will be straightforward. If this assignment isn’t
straightforward, you may not have enough C++ background to take CS3251.
You are being provided with three files: main.cpp, TestType.h, and a CMakeLists.txt. The task for Part
1 of the assignment is to provide a SimpleArray.h file that contains all necessary include files, the class
definition, function definitions (appropriately commented) and comments (as required by the course coding
standard) that would make the code compile cleanly.
All stud

Loops, Arrays, Constructors, Methods

Loops, Arrays, Constructors, Methods

In languages that use the same or similar alphabets, some characters will occur with greater frequency that others. Consider the Latin alphabet, for example, used by most of Western and Central Europe and other parts of the world. Some languages, for example, may not use all of the 26 characters that we are used to. You can learn a lot about languages by comparing the relative frequencies of character use.

A table of frequencies might look something like this:

          *     *               
          *     *               
          *   * * *             
          *   * * *             
          *   * * *             
        * *   * * *             
      * * *   * * *             
      * * * * * * * *           
      * * * * * * * *           
      * * * * * * * * *         
      * * * * * * * * *         
      c d e l m n o p v 

In this project, we will write a program that takes

C++ Data Structure

### Message Sending Rules

Your agent should implement the following rules for sending messages:

– An agent should never send the same message (i.e., a message with the
same `msg_id`) to the same neighbour twice nor should it send a message
to the same neighbour from which the messages was received.

– At each iteration an agent may choose to broadcast a single new
message with the following probabilities:

| Agent’s Personality | **RED** Message | **GREEN** Message | **BLUE** Message | None |
| ——————- | ————— | —————– | —————- | —- |
| **CHATTY** | 30% | 10% | 20% | 40% |
| **QUIET** | 10% | 5% | 10% | 75% |

E.g., a **QUIET** agent will send a **GREEN** message with 5% probability.

– At each iteration and for each newly received message, an agent may
choose to forward the message independently to each of its
neighbours according to the following rules:

| Agent’s Personality | Neighour’s Personality | Message Type | Forward | Don’t Fwd |

C++ Basic

#1. Timetest (30 points with 25 points for write-up and 5 points for timetest.cpp) The purpose of this question is to explore how different ADTs affect the runtime of a program.  The program simply inserts and/or deletes data items from an ADT.  The sequence of insert and delete operations is specified in a data file.  You will find four data files (File1.dat, File2.dat, File3.dat, and File4.dat) in ~neff/60/p1 that model different types of behavior and you should use these to analyze the performance of different ADTs.  The first line of each data file summarizes the operations in the file.    You will submit a typed, double-spaced, 2-4 page report (writeup.pdf) that summarizes your findings on the performance of each ADT for these different sets of operations.  Also submit the driver program described below.


Start by writing a driver program, timetest.cpp, that will ask for the name of an input file that contains a list of commands and then repeatedly ask the user for the ADT t


Homework 6 – Paging
Due by 3:30 p.m. Tuesday, 12/1/15
Write a program that simulates the FIFO and LRU page-replacement algorithms. Your program should
accept four command-line arguments specifying the page size, the total logical memory size, the pagereplacement
algorithm to use, and the number of frames allocated. The page and logical memory sizes
should be specified by their binary logs. Thus, the following command would simulate a page size of
1KB and a logical memory size of 64KB, using LRU page-replacement with 8 frames allocated:
./simulate-paging 10 16 LRU 8
Your program should read lines from standard input, each containing a hexadecimal number
representing the virtual address of a memory reference. With each memory reference, your program
should update an internal page table, keeping track of the number of page faults generated (using pure
demand paging). Your program should also maintain any other data structures necessary to implement
the two page-replacement algorithms. Your program should termina

Parallel Computing and Dijkstra's Algorithm

Department of Computer Science Intro to Parallel Computing
Programming Assignment 3
Due Wednesday, October 28 at 6 pm
Dijkstra’s Algorithm
Edsger Dijkstra was a Dutch computer scientist. He is unquestionably one of the found-
ing fathers of computer science. In addition to devising Dijkstra’s algorithm, he was one
of the originators of structured programming | a precursor to modern object-oriented pro-
gramming. C, for example, is a structured programming language. He also made many
contributions to the solution of process-coordination problems in parallel computing: we’ll
learn about several later on in the course. His Wikipedia page lists more than fty funda-
mental contributions to computer science.
Dijkstra’s algorithm solves the single-source shortest path problem” in a weighted, di-
rected graph. The input consists of a weighted, directed graph and a speci ed vertex in the
graph. A directed graph or digraph is a collection of vertices and directed edges, which join
one vertex to another. A weighted dig

Raspberry Pi电脑板

CSE30 – HW #2
Part I – Due Monday Oct 26, 2015 by 11:30pm
Part II – Due Monday Nov 2, 2015 by 11:30 pm
This is an assignment in two parts. In the first part you are given more
practice with GDB, the GNU Project Debugger and a lot of practice with
pointers by writing C code that uses them heavily. You will also make your
first venture into Assembly.
The second part of the assignment focusses on translating your C code
to Assembly. After completing the assignment you should know many of the
important ARM instructions (particularly those that interact with memory)
and understand what goes on under the hood of your C program.
Please note that part II is due one week after the due date of part I.
This assignment is subject to the style guidelines posted on the course
All parts of this assignment should be completed and tested on
the Raspberry Pi.
Part I
1 GDB: More debugging practice
GDB allows you to inspect and modify the program as it

Battleship Recursion

CSCI-1200 Data Structures | Fall 2015
Homework 6 | Battleship Recursion
In this homework we will solve ship placement puzzles inspired by the pencil & paper Battleship” game that
was later made into a board game by Milton Bradley and then a puzzle that is a regular feature in Games
magazine. You can read more about the history of the game and see examples here:
This is a popular game with lots of material available online. You may not search for, study, or use any code
related to the Battleship game or puzzle. Please carefully read the entire assignment and study the examples
before beginning your implementation.