## 3 Architecture for CaaS Cloud  
An overview of the CaaS cloud architecture is shown in Figure 3. It is divided into two main parts: the user side and the cloud system. The user side consists of different types of jobs: user application, user task, data analytics, transaction processing, image processing, etc. Each job in the CaaS cloud architecture comprises several independent tasks that are executed in a container. For each independent task, a separate container is allocated. On the other hand, the cloud system facilitates all hardware and software requirements and provides computing capability, storage, and networking for data sharing. There will be more than one server available in the cloud system, which is responsible for providing resources to a virtual machine. All virtual machines are hosted in servers, and on top of it, all containers are deployed in virtual machines. The number of VMs a server can accommodate depends on the server's available memory size and processor core. Similarly, the number of containers a VM can run depends upon the available resource of the VM [45]. The interaction among the main components of the CaaS cloud architecture is described in Figure 4. In the CaaS cloud architecture, the cloud system has four main components. **Container Mapper:** The container mapper accepts users' tasks from the task manager and prepares a container by packaging all the binaries and libraries required for it. The task gets executed in that container. The main responsibility of the container mapper is placing a container into a suitable VM or PM. An example container placement mechanism is depicted in Figure 5. For example, three servers or physical machines are there in the cloud. Server-1 has instantiated two VMs, VM-1 and VM-2. In VM-1, two containers C1 and C2 are running. In VM-2, there is only one container, C3, running. Similarly, in Server-2, two VMs are instantiated, each running one container. In Server-3, two VMs are instantiated, but only one VM is running one container. Now, suppose C7 is the new container that needs to be  
Figure 3: Architecture for CaaS Cloud. placed in any VM. The container scheduler will take this decision and determine a suitable VM for it, and the container mapper will place that container in the selected VM. **Resource Manager:** The resource manager maintains and keeps track of the information about both physical machines and virtual machines, as shown in Figure 6. The Physical Machine Controller (PMC) available in each physical machine maintains information about how many VMs and types of VMs are instantiated in a physical machine and available resource information. Similarly, the virtual machine controller (VMC) is a demon present in each virtual machine responsible for maintaining resource information in a VM, such as the number of containers running and available resources. **Migration Manager:** The migration manager is responsible for migrating VMs from one PM to another. Migrating a VM is to improve resource utilization by evenly distributing instantiated VMs among all available PMs and minimizing the active PMs. VM migration takes place from overloaded PMs to lightly loaded PMs. If a PM X is active with a minimal workload, we can migrate the workload of X to another moderately loaded PM Y and turn off the PM X to minimize the number of PMs. The migration manager immediately updates the migration information to the resource manager when there is any VM migration. Similarly, a container can be migrated from one VM to another to balance the workload among VMs. A container can be migrated from one VM on server X to another VM on server Y, termed interPM container migration. If a container is migrated from one VM to another VM in the same physical machine, it is called intraVM container migration. PMC and VMC are responsible for updating VM and container migration information, respectively, to the migration manager. **Container Scheduler:** The container scheduler determines which container will be deployed in which virtual machine.